Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Select: Show missing checkbox in multiple select #8525

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion css/themes/default/jquery.mobile.theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,18 @@ html .ui-alt-icon .ui-radio-off .ui-icon {
opacity: .3;
}

.ui-checkboxradio-label:not(.ui-checkboxradio-radio-label) .ui-checkboxradio-icon {
.ui-checkboxradio-label:not(.ui-checkboxradio-radio-label) .ui-checkboxradio-icon,
.ui-listview-item .ui-checkboxradio-icon {
-webkit-border-radius: .1875em;
border-radius: .1875em;
}

.ui-listview-item .ui-checkboxradio-icon {
position: absolute;
right: .5625em;
top: 30%;
}

.ui-checkboxradio-checked .ui-checkboxradio-icon {
filter: none;
opacity: 1;
Expand Down Expand Up @@ -337,6 +344,7 @@ html body .ui-group-theme-a .ui-button.ui-button-active,
html head + body .ui-button.ui-button-a.ui-button-active,
/* Active checkboxradio */
.ui-page-theme-a .ui-checkboxradio-checked .ui-icon,
.ui-page-theme-a .ui-listview-item .ui-checkboxradio-icon.ui-state-checked,
html .ui-bar-a .ui-checkboxradio-checked .ui-icon,
html .ui-body-a .ui-checkboxradio-checked .ui-icon,
html body .ui-group-theme-a .ui-checkboxradio-checked .ui-icon,
Expand Down Expand Up @@ -516,6 +524,7 @@ html body .ui-group-theme-b .ui-button.ui-button-active,
html head + body .ui-button.ui-button-b.ui-button-active,
/* Active checkboxradio */
.ui-page-theme-b .ui-checkboxradio-checked .ui-icon,
.ui-page-theme-b .ui-listview-item .ui-checkboxradio-icon.ui-state-checked,
html .ui-bar-b .ui-checkboxradio-checked .ui-icon,
html .ui-body-b .ui-checkboxradio-checked .ui-icon,
html body .ui-group-theme-b .ui-checkboxradio-checked .ui-icon,
Expand Down
27 changes: 17 additions & 10 deletions js/widgets/forms/select.custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ return $.widget( "mobile.selectmenu", $.mobile.selectmenu, {

// Toggle checkbox class for multiple selects
if ( this.isMultiple ) {
anchors = listItem.find( "a" );
this._toggleClass( anchors, null, "ui-checkbox-on", option.selected );
this._toggleClass( anchors, null, "ui-checkbox-off", !option.selected );
anchors = listItem.find( "a .ui-checkboxradio-icon" );
this._toggleClass( anchors, null, "ui-icon-check ui-state-checked", option.selected );
this._toggleClass( anchors, null, "ui-icon-blank", !option.selected );
}

// If it's not a multiple select, trigger change after it has finished closing
Expand Down Expand Up @@ -403,9 +403,9 @@ return $.widget( "mobile.selectmenu", $.mobile.selectmenu, {

// Multiple selects: add the "on" checkbox state to the icon
if ( this.isMultiple ) {
anchors = item.find( "a" );
this._removeClass( anchors, null, "ui-checkbox-off" );
this._addClass( anchors, null, "ui-checkbox-on" );
anchors = item.find( "a .ui-checkboxradio-icon" );
this._removeClass( anchors, null, "ui-icon-blank" );
this._addClass( anchors, null, "ui-icon-check ui-state-checked" );
} else {
if ( item.hasClass( "ui-screen-hidden" ) ) {
this._addClass( item.next().find( "a" ), null, "ui-button-active" );
Expand All @@ -414,9 +414,9 @@ return $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
}
}
} else if ( this.isMultiple ) {
anchors = item.find( "a" );
this._removeClass( anchors, null, "ui-checkbox-on" );
this._addClass( anchors, null, "ui-checkbox-off" );
anchors = item.find( "a .ui-checkboxradio-icon" );
this._removeClass( anchors, null, "ui-icon-check ui-state-checked" );
this._addClass( anchors, null, "ui-icon-blank" );
}
}, this ) );
},
Expand Down Expand Up @@ -659,7 +659,14 @@ return $.widget( "mobile.selectmenu", $.mobile.selectmenu, {
item.setAttribute( "role", "option" );
anchor.setAttribute( "tabindex", "-1" );
if ( this.isMultiple ) {
this._addClass( $( anchor ), null, "ui-button ui-checkbox-off ui-icon-end" );
this._addClass( $( anchor ), null, "ui-button ui-icon-end" );

var spanEl = $( "<span></span>", {
"class": "ui-checkboxradio-icon ui-corner-all" +
" ui-icon ui-icon-blank ui-icon-background"
} );

$( anchor ).append( spanEl );
}

item.appendChild( anchor );
Expand Down