Skip to content

Commit abc2a75

Browse files
arschmitzscottgonzalez
authored andcommitted
Checkboxradio: Use new ui-state-checked class in checkboxradio
Using `ui-state-highlight` caused a conflict with dialog Fixes #14955 Closes gh-1712 Closes gh-1704
1 parent b7d0c70 commit abc2a75

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

tests/unit/checkboxradio/options.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function assertIcon( checkbox, icon, assert ) {
7272
"ui-icon-background ui-icon-" + icon,
7373
"Icon has proper classes" );
7474
if ( icon === "blank" ) {
75-
assert.lacksClasses( iconElement, "ui-icon-check ui-state-highlight" );
75+
assert.lacksClasses( iconElement, "ui-icon-check ui-state-checked" );
7676
}
7777
}
7878

@@ -100,7 +100,7 @@ QUnit.test( "icon - default checked", function( assert ) {
100100
assert.expect( 2 );
101101

102102
checkbox.checkboxradio();
103-
assertIcon( checkbox, "check ui-state-highlight", assert );
103+
assertIcon( checkbox, "check ui-state-checked", assert );
104104
} );
105105

106106
QUnit.test( "icon", function( assert ) {
@@ -111,13 +111,13 @@ QUnit.test( "icon", function( assert ) {
111111
checkbox.prop( "checked", true );
112112

113113
checkbox.checkboxradio();
114-
assertIcon( checkbox, "check ui-state-highlight", assert );
114+
assertIcon( checkbox, "check ui-state-checked", assert );
115115

116116
checkbox.checkboxradio( "option", "icon", false );
117117
assertNoIcon( assert, checkbox );
118118

119119
checkbox.checkboxradio( "option", "icon", true );
120-
assertIcon( checkbox, "check ui-state-highlight", assert );
120+
assertIcon( checkbox, "check ui-state-checked", assert );
121121

122122
checkbox.checkboxradio( "option", "icon", false );
123123
assertNoIcon( assert, checkbox );

themes/base/theme.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ a.ui-button:active,
137137
background: #fffa90/*{bgColorHighlight}*/ /*{bgImgUrlHighlight}*/ /*{bgHighlightXPos}*/ /*{bgHighlightYPos}*/ /*{bgHighlightRepeat}*/;
138138
color: #777620/*{fcHighlight}*/;
139139
}
140+
.ui-state-checked {
141+
border: 1px solid #dad55e/*{borderColorHighlight}*/;
142+
background: #fffa90/*{bgColorHighlight}*/;
143+
}
140144
.ui-state-highlight a,
141145
.ui-widget-content .ui-state-highlight a,
142146
.ui-widget-header .ui-state-highlight a {

ui/widgets/checkboxradio.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,10 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
176176
this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked );
177177

178178
if ( this.options.icon && this.type === "checkbox" ) {
179-
180-
// We add ui-state-highlight to change the icon color
181-
this._toggleClass( this.icon, null, "ui-icon-check ui-state-highlight", checked )
179+
this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked )
182180
._toggleClass( this.icon, null, "ui-icon-blank", !checked );
183181
}
182+
184183
if ( this.type === "radio" ) {
185184
this._getRadioGroup()
186185
.each( function() {
@@ -233,14 +232,14 @@ $.widget( "ui.checkboxradio", [ $.ui.formResetMixin, {
233232
}
234233

235234
if ( this.type === "checkbox" ) {
236-
toAdd += checked ? "ui-icon-check ui-state-highlight" : "ui-icon-blank";
235+
toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
237236
this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" );
238237
} else {
239238
toAdd += "ui-icon-blank";
240239
}
241240
this._addClass( this.icon, "ui-checkboxradio-icon", toAdd );
242241
if ( !checked ) {
243-
this._removeClass( this.icon, null, "ui-icon-check ui-state-highlight" );
242+
this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" );
244243
}
245244
this.icon.prependTo( this.label ).after( this.iconSpace );
246245
} else if ( this.icon !== undefined ) {

0 commit comments

Comments
 (0)