Skip to content

Commit c4191d9

Browse files
zachleatWilto
authored andcommitted
Fix for browsers with JavaScript but without box-shadow enabled. outline: 0; outline-width: 2px; doesn't work, requires an outline-style to be set.
1 parent 328bbec commit c4191d9

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

css/themes/default/jquery.mobile.theme.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ a.ui-link-inherit {
11091109
box-shadow: 0px 1px 0 rgba(255,255,255,.4);
11101110
}
11111111

1112-
/* Focus state - set here for specificity
1112+
/* Focus state - set here for specificity (note: these classes are added by JavaScript)
11131113
-----------------------------------------------------------------------------------------------------------*/
11141114

11151115
.ui-btn:focus {
@@ -1135,5 +1135,6 @@ a.ui-link-inherit {
11351135
/* ...and bring back focus */
11361136
.ui-mobile-nosupport-boxshadow .ui-focus,
11371137
.ui-mobile-nosupport-boxshadow .ui-btn:focus {
1138-
outline-width: 2px;
1139-
}
1138+
outline-width: 1px;
1139+
outline-style: dotted;
1140+
}

js/jquery.mobile.forms.slider.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,16 +181,21 @@ $.widget( "mobile.slider", $.mobile.widget, {
181181

182182
slider.insertAfter( control );
183183

184-
// NOTE force focus on handle
185-
this.handle.bind({
186-
focus: function() {
187-
( cType == 'select' ? slider : $( this ) ).addClass( $.mobile.focusClass );
188-
},
189-
190-
blur: function() {
191-
( cType == 'select' ? slider : $( this ) ).removeClass( $.mobile.focusClass );
192-
},
184+
// Only add focus class to toggle switch, sliders get it automatically from ui-btn
185+
if( cType == 'select' ) {
186+
this.handle.bind({
187+
focus: function() {
188+
( $.support.boxShadow ? slider : $( this ) ).addClass( $.mobile.focusClass );
189+
},
190+
191+
blur: function() {
192+
( $.support.boxShadow ? slider : $( this ) ).removeClass( $.mobile.focusClass );
193+
}
194+
});
195+
}
193196

197+
this.handle.bind({
198+
// NOTE force focus on handle
194199
vmousedown: function() {
195200
$( this ).focus();
196201
},

0 commit comments

Comments
 (0)