Skip to content

Commit b0b446d

Browse files
committed
fix(checkbox): Remove tap highlight and fix checkbox appearance in Firefox, closes #496
1 parent 757f181 commit b0b446d

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

Diff for: js/ext/angular/src/directive/ionicCheckbox.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ angular.module('ionic.ui.checkbox', [])
3434
transclude: true,
3535

3636
template: '<label class="item item-checkbox">' +
37-
'<div class="checkbox">' +
37+
'<div class="checkbox checkbox-input-hidden">' +
3838
'<input type="checkbox" ng-model="ngModel" ng-value="ngValue" ng-change="ngChange()">' +
39+
'<div class="checkbox-handle"></div>' +
3940
'</div>' +
4041
'<div class="item-content disable-pointer-events" ng-transclude></div>' +
4142
'</label>',

Diff for: scss/_checkbox.scss

+12-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@
4242
}
4343
}
4444

45-
.checkbox input {
45+
.checkbox-input-hidden input {
46+
display: none;
47+
}
48+
49+
.checkbox input,
50+
.checkbox .checkbox-handle {
4651
position: relative;
4752
width: $checkbox-width;
4853
height: $checkbox-height;
@@ -64,7 +69,8 @@
6469
}
6570

6671
/* the checkmark within the box */
67-
.checkbox input:after {
72+
.checkbox input:after,
73+
.checkbox .checkbox-handle:after {
6874
@include transition(opacity .05s ease-in-out);
6975
@include rotate(-45deg);
7076
position: absolute;
@@ -80,7 +86,8 @@
8086
opacity: 0;
8187
}
8288

83-
.grade-c .checkbox input:after {
89+
.grade-c .checkbox input:after,
90+
.grade-c .checkbox .checkbox-handle:after {
8491
@include rotate(0);
8592
top: 3px;
8693
left: 4px;
@@ -92,7 +99,8 @@
9299
}
93100

94101
/* what the checkmark looks like when its checked */
95-
.checkbox input:checked:after {
102+
.checkbox input:checked:after,
103+
.checkbox input:checked + .checkbox-handle:after {
96104
opacity: 1;
97105
}
98106

Diff for: scss/_mixins.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,14 @@
126126
// --------------------------------------------------
127127

128128
@mixin checkbox-style($off-border-color, $on-bg-color) {
129-
& input:before {
129+
& input:before,
130+
& .checkbox-handle:before {
130131
border: $checkbox-border-width solid $off-border-color;
131132
}
132133

133134
// what the background looks like when its checked
134-
& input:checked:before {
135+
& input:checked:before,
136+
& input:checked + .checkbox-handle:before {
135137
background: $on-bg-color;
136138
}
137139
}

0 commit comments

Comments
 (0)