Skip to content

Commit

Permalink
Updated component to version 2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Semantic-Pusher-Robot committed Jul 17, 2015
1 parent eef0f83 commit 882bf82
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 67 deletions.
8 changes: 8 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### Version 2.0.4 - July 17, 2015

- **Checkbox** - Checkbox now focus after click, allowing for tab navigation from current position [#2610](https://github.com/Semantic-Org/Semantic-UI/issues/2610)
- **Checkbox** - Fixed checkbox not using javascript having incorrect colors on focus [#2607](https://github.com/Semantic-Org/Semantic-UI/issues/2607)
- **Checkbox** - Fixed `space` shortcut causing checkbox to trigger twice
- **Checkbox** - Updated `colored` theme to add new focus color variables.
- Updated example in theme guide to include checkbox focus colors

### Version 2.0.3 - July 8, 2015

- **Checkbox** - Checkbox initialized with JS and with `for/id` matching would cause toggle to occur twice on click (making it seem as if nothing was updated) **thanks @malacalypse** [#2572](https://github.com/Semantic-Org/Semantic-UI/issues/2572)
Expand Down
144 changes: 88 additions & 56 deletions checkbox.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 2.0.3 - Checkbox
* # Semantic UI 2.0.4 - Checkbox
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down Expand Up @@ -31,6 +31,8 @@
line-height: 17px;
min-width: 17px;
}

/* HTML Checkbox */
.ui.checkbox input[type="checkbox"],
.ui.checkbox input[type="radio"] {
cursor: pointer;
Expand Down Expand Up @@ -142,30 +144,24 @@
.ui.checkbox label:active::after {
color: rgba(0, 0, 0, 0.95);
}
.ui.checkbox input[type="checkbox"]:active ~ label,
.ui.checkbox input[type="radio"]:active ~ label {
.ui.checkbox input:active ~ label {
color: rgba(0, 0, 0, 0.95);
}

/*--------------
Focus
---------------*/

.ui.checkbox input[type="checkbox"]:focus ~ .box:before,
.ui.checkbox input[type="checkbox"]:focus ~ label:before,
.ui.checkbox input[type="radio"]:focus ~ .box:before,
.ui.checkbox input[type="radio"]:focus ~ label:before {
.ui.checkbox input:focus ~ .box:before,
.ui.checkbox input:focus ~ label:before {
background: #f9fafb;
border-color: rgba(34, 36, 38, 0.35);
}
.ui.checkbox input[type="checkbox"]:focus ~ .box:after,
.ui.checkbox input[type="checkbox"]:focus ~ label:after,
.ui.checkbox input[type="radio"]:focus ~ .box:after,
.ui.checkbox input[type="radio"]:focus ~ label:after {
.ui.checkbox input:focus ~ .box:after,
.ui.checkbox input:focus ~ label:after {
color: rgba(0, 0, 0, 0.95);
}
.ui.checkbox input[type="checkbox"]:focus ~ label,
.ui.checkbox input[type="radio"]:focus ~ label {
.ui.checkbox input:focus ~ label {
color: rgba(0, 0, 0, 0.95);
}

Expand All @@ -188,13 +184,13 @@
Indeterminate
---------------*/

.ui.checkbox input[type="checkbox"]:indeterminate ~ .box:before,
.ui.checkbox input[type="checkbox"]:indeterminate ~ label:before {
.ui.checkbox input:indeterminate ~ .box:before,
.ui.checkbox input:indeterminate ~ label:before {
background: #ffffff;
border-color: rgba(34, 36, 38, 0.35);
}
.ui.checkbox input[type="checkbox"]:indeterminate ~ .box:after,
.ui.checkbox input[type="checkbox"]:indeterminate ~ label:after {
.ui.checkbox input:indeterminate ~ .box:after,
.ui.checkbox input:indeterminate ~ label:after {
opacity: 1;
color: rgba(0, 0, 0, 0.95);
}
Expand All @@ -203,12 +199,18 @@
Active Focus
---------------*/

.ui.checkbox input[type="checkbox"]:indeterminate:focus ~ .box:before,
.ui.checkbox input[type="checkbox"]:indeterminate:focus ~ label:before,
.ui.checkbox input[type="checkbox"]:checked:focus ~ .box:before,
.ui.checkbox input[type="checkbox"]:checked:focus ~ label:before {
.ui.checkbox input:indeterminate:focus ~ .box:before,
.ui.checkbox input:indeterminate:focus ~ label:before,
.ui.checkbox input:checked:focus ~ .box:before,
.ui.checkbox input:checked:focus ~ label:before {
background: #f9fafb;
border-color: rgba(34, 36, 38, 0.35);
border-color: rgba(34, 36, 38, 0.5);
}
.ui.checkbox input:indeterminate:focus ~ .box:after,
.ui.checkbox input:indeterminate:focus ~ label:after,
.ui.checkbox input:checked:focus ~ .box:after,
.ui.checkbox input:checked:focus ~ label:after {
color: rgba(0, 0, 0, 0.95);
}

/*--------------
Expand Down Expand Up @@ -240,14 +242,12 @@

/* Initialized checkbox moves input below element
to prevent manually triggering */
.ui.checkbox input[type="checkbox"].hidden,
.ui.checkbox input[type="radio"].hidden {
.ui.checkbox input.hidden {
z-index: -1;
}

/* Selectable Label */
.ui.checkbox input[type="checkbox"].hidden + label,
.ui.checkbox input[type="radio"].hidden + label {
.ui.checkbox input.hidden + label {
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
Expand Down Expand Up @@ -311,13 +311,33 @@
background-color: rgba(0, 0, 0, 0.87);
}

/* Focus */
.ui.radio.checkbox input:focus ~ .box:before,
.ui.radio.checkbox input:focus ~ label:before {
background-color: #f9fafb;
}
.ui.radio.checkbox input:focus ~ .box:after,
.ui.radio.checkbox input:focus ~ label:after {
background-color: rgba(0, 0, 0, 0.95);
}

/* Active */
.ui.radio.checkbox input[type="radio"]:checked ~ .box:before,
.ui.radio.checkbox input[type="radio"]:checked ~ label:before {
.ui.radio.checkbox input:checked ~ .box:before,
.ui.radio.checkbox input:checked ~ label:before {
background-color: #ffffff;
}
.ui.radio.checkbox input[type="radio"]:checked ~ .box:after,
.ui.radio.checkbox input[type="radio"]:checked ~ label:after {
.ui.radio.checkbox input:checked ~ .box:after,
.ui.radio.checkbox input:checked ~ label:after {
background-color: rgba(0, 0, 0, 0.95);
}

/* Active Focus */
.ui.radio.checkbox input:focus:checked ~ .box:before,
.ui.radio.checkbox input:focus:checked ~ label:before {
background-color: #f9fafb;
}
.ui.radio.checkbox input:focus:checked ~ .box:after,
.ui.radio.checkbox input:focus:checked ~ label:after {
background-color: rgba(0, 0, 0, 0.95);
}

Expand All @@ -330,8 +350,7 @@
}

/* Input */
.ui.slider.checkbox input[type="checkbox"],
.ui.slider.checkbox input[type="radio"] {
.ui.slider.checkbox input {
width: 3.5rem;
height: 1.25rem;
}
Expand Down Expand Up @@ -389,10 +408,8 @@
}

/* Focus */
.ui.slider.checkbox input[type="checkbox"]:focus ~ .box:before,
.ui.slider.checkbox input[type="checkbox"]:focus ~ label:before,
.ui.slider.checkbox input[type="radio"]:focus ~ .box:before,
.ui.slider.checkbox input[type="radio"]:focus ~ label:before {
.ui.slider.checkbox input:focus ~ .box:before,
.ui.slider.checkbox input:focus ~ label:before {
background-color: rgba(0, 0, 0, 0.15);
border: none;
}
Expand All @@ -408,19 +425,29 @@
}

/* Active */
.ui.slider.checkbox :checked ~ .box,
.ui.slider.checkbox :checked ~ label {
color: rgba(0, 0, 0, 0.95);
.ui.slider.checkbox input:checked ~ .box,
.ui.slider.checkbox input:checked ~ label {
color: rgba(0, 0, 0, 0.95) !important;
}
.ui.slider.checkbox :checked ~ .box:before,
.ui.slider.checkbox :checked ~ label:before {
background-color: #545454;
.ui.slider.checkbox input:checked ~ .box:before,
.ui.slider.checkbox input:checked ~ label:before {
background-color: #545454 !important;
}
.ui.slider.checkbox :checked ~ .box:after,
.ui.slider.checkbox :checked ~ label:after {
.ui.slider.checkbox input:checked ~ .box:after,
.ui.slider.checkbox input:checked ~ label:after {
left: 2rem;
}

/* Active Focus */
.ui.slider.checkbox input:focus:checked ~ .box,
.ui.slider.checkbox input:focus:checked ~ label {
color: rgba(0, 0, 0, 0.95) !important;
}
.ui.slider.checkbox input:focus:checked ~ .box:before,
.ui.slider.checkbox input:focus:checked ~ label:before {
background-color: #000000 !important;
}

/*--------------
Toggle
---------------*/
Expand All @@ -430,8 +457,7 @@
}

/* Input */
.ui.toggle.checkbox input[type="checkbox"],
.ui.toggle.checkbox input[type="radio"] {
.ui.toggle.checkbox input {
width: 3.5rem;
height: 1.5rem;
}
Expand Down Expand Up @@ -484,18 +510,14 @@
-webkit-transition: background 0.3s ease, left 0.3s ease;
transition: background 0.3s ease, left 0.3s ease;
}
.ui.toggle.checkbox input[type="checkbox"] ~ .box:after,
.ui.toggle.checkbox input[type="checkbox"] ~ label:after,
.ui.toggle.checkbox input[type="radio"] ~ .box:after,
.ui.toggle.checkbox input[type="radio"] ~ label:after {
.ui.toggle.checkbox input ~ .box:after,
.ui.toggle.checkbox input ~ label:after {
left: -0.05rem;
}

/* Focus */
.ui.toggle.checkbox input[type="checkbox"]:focus ~ .box:before,
.ui.toggle.checkbox input[type="checkbox"]:focus ~ label:before,
.ui.toggle.checkbox input[type="radio"]:focus ~ .box:before,
.ui.toggle.checkbox input[type="radio"]:focus ~ label:before {
.ui.toggle.checkbox input:focus ~ .box:before,
.ui.toggle.checkbox input:focus ~ label:before {
background-color: rgba(0, 0, 0, 0.15);
border: none;
}
Expand All @@ -510,17 +532,27 @@
/* Active */
.ui.toggle.checkbox input:checked ~ .box,
.ui.toggle.checkbox input:checked ~ label {
color: rgba(0, 0, 0, 0.95);
color: rgba(0, 0, 0, 0.95) !important;
}
.ui.toggle.checkbox input:checked ~ .box:before,
.ui.toggle.checkbox input:checked ~ label:before {
background-color: #2185d0;
background-color: #2185d0 !important;
}
.ui.toggle.checkbox input:checked ~ .box:after,
.ui.toggle.checkbox input:checked ~ label:after {
left: 2.15rem;
}

/* Active Focus */
.ui.toggle.checkbox input:focus:checked ~ .box,
.ui.toggle.checkbox input:focus:checked ~ label {
color: rgba(0, 0, 0, 0.95) !important;
}
.ui.toggle.checkbox input:focus:checked ~ .box:before,
.ui.toggle.checkbox input:focus:checked ~ label:before {
background-color: #0d71bb !important;
}


/*******************************
Variations
Expand Down
5 changes: 3 additions & 2 deletions checkbox.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* # Semantic UI 2.0.3 - Checkbox
* # Semantic UI 2.0.4 - Checkbox
* http://github.com/semantic-org/semantic-ui/
*
*
Expand Down Expand Up @@ -177,6 +177,7 @@ $.fn.checkbox = function(parameters) {
return;
}
module.toggle();
$input.focus();
event.preventDefault();
},
keydown: function(event) {
Expand All @@ -193,7 +194,7 @@ $.fn.checkbox = function(parameters) {
$input.blur();
event.preventDefault();
}
if(!event.ctrlKey && (key == keyCode.enter || key == keyCode.space)) {
if(!event.ctrlKey && (key == keyCode.enter)) {
module.verbose('Enter key pressed, toggling checkbox');
module.toggle();
event.preventDefault();
Expand Down
Loading

0 comments on commit 882bf82

Please sign in to comment.