diff --git a/demos/selectmenu/custom_render.html b/demos/selectmenu/custom_render.html index 2e775084c..39d1534de 100644 --- a/demos/selectmenu/custom_render.html +++ b/demos/selectmenu/custom_render.html @@ -8,7 +8,6 @@ - diff --git a/demos/selectmenu/default.html b/demos/selectmenu/default.html index da91cf16f..97bbe6e3d 100644 --- a/demos/selectmenu/default.html +++ b/demos/selectmenu/default.html @@ -8,7 +8,6 @@ - diff --git a/tests/unit/selectmenu/selectmenu.html b/tests/unit/selectmenu/selectmenu.html index c64b364fa..cca8c2631 100644 --- a/tests/unit/selectmenu/selectmenu.html +++ b/tests/unit/selectmenu/selectmenu.html @@ -5,14 +5,12 @@ jQuery UI Selectmenu Test Suite - - diff --git a/tests/visual/selectmenu/compatibility.html b/tests/visual/selectmenu/compatibility.html index 3629243a3..bd00804f3 100644 --- a/tests/visual/selectmenu/compatibility.html +++ b/tests/visual/selectmenu/compatibility.html @@ -11,7 +11,6 @@ - diff --git a/tests/visual/selectmenu/disabled.html b/tests/visual/selectmenu/disabled.html index b74b93530..4129e95e4 100644 --- a/tests/visual/selectmenu/disabled.html +++ b/tests/visual/selectmenu/disabled.html @@ -8,7 +8,6 @@ - diff --git a/tests/visual/selectmenu/events.html b/tests/visual/selectmenu/events.html index 7371e1373..206995805 100644 --- a/tests/visual/selectmenu/events.html +++ b/tests/visual/selectmenu/events.html @@ -8,7 +8,6 @@ - diff --git a/tests/visual/selectmenu/methods.html b/tests/visual/selectmenu/methods.html index d2654abfa..87dae0291 100644 --- a/tests/visual/selectmenu/methods.html +++ b/tests/visual/selectmenu/methods.html @@ -8,7 +8,6 @@ - diff --git a/themes/base/jquery.ui.selectmenu.css b/themes/base/jquery.ui.selectmenu.css index e6f624ff0..04da7f649 100644 --- a/themes/base/jquery.ui.selectmenu.css +++ b/themes/base/jquery.ui.selectmenu.css @@ -13,6 +13,5 @@ .ui-selectmenu-menu .ui-menu li.ui-state-disabled { padding: 0.3em 1em 0.3em 1em; } .ui-selectmenu-menu .ui-menu li.ui-selectmenu-optgroup { font-weight: bold; line-height: 1.5; padding: 2px 0.4em; margin: 0.5em 0 0 0; } .ui-selectmenu-open { display: block; } - -.ui-selectmenu-button span.ui-icon { right: 0.5em; left: auto; } -.ui-selectmenu-button span.ui-button-text { text-align: left; padding: 0.4em 2.1em 0.4em 1em } \ No newline at end of file +.ui-selectmenu-button span.ui-icon { right: 0.5em; left: auto; margin-top: -8px; position: absolute; top: 50%; } +.ui-selectmenu-button span.ui-selectmenu-text { text-align: left; padding: 0.4em 2.1em 0.4em 1em; display: block; line-height: 1.4; } \ No newline at end of file diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index ad4608ec8..9f655fbe6 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -12,7 +12,6 @@ * jquery.ui.widget.js * jquery.ui.position.js * jquery.ui.menu.js - * jquery.ui.button.js */ (function( $, undefined ) { @@ -68,23 +67,25 @@ $.widget( "ui.selectmenu", { // create button this.button = $( '', { - href: '#' + this.ids.id, - html: this.element.find( "option:selected" ).text() || ' ', - tabindex: ( tabindex ? tabindex : this.options.disabled ? -1 : 0 ), - id: this.ids.button, - width: this.element.outerWidth(), - 'aria-expanded': false, - 'aria-autocomplete': 'list', - 'aria-owns': this.ids.menu, - 'aria-haspopup': true + 'class': 'ui-button ui-widget ui-state-default ui-corner-all', + href: '#' + this.ids.id, + tabindex: ( tabindex ? tabindex : this.options.disabled ? -1 : 0 ), + id: this.ids.button, + width: this.element.outerWidth(), + role: 'combobox', + 'aria-expanded': false, + 'aria-autocomplete': 'list', + 'aria-owns': this.ids.menu, + 'aria-haspopup': true + }); + + this.button.prepend( $( '' ) ); + + this.buttonText = $( '', { + 'class': 'ui-selectmenu-text' , + html: this.element.find( "option:selected" ).text() || ' ' }) - .button({ - icons: { - primary: ( this.options.dropdown ? 'ui-icon-triangle-1-s' : 'ui-icon-triangle-2-n-s' ) - } - }) - // change ARIA role - .attr( 'role', 'combobox' ); + .appendTo( this.button ); // wrap and insert new button this.buttonWrap = $( '', { @@ -108,8 +109,7 @@ $.widget( "ui.selectmenu", { if ( this.options.dropdown ) { var setWidth = this.button.outerWidth(); } else { - var text = this.button.find( "span.ui-button-text"), - setWidth = text.width() + parseFloat( text.css( "padding-left" ) ) || 0 + parseFloat( text.css( "margin-left" ) || 0 ); + var setWidth = this.buttonText.width() + parseFloat( this.buttonText.css( "padding-left" ) ) || 0 + parseFloat( this.buttonText.css( "margin-left" ) || 0 ); } // wrap menu @@ -391,7 +391,7 @@ $.widget( "ui.selectmenu", { _setSelected: function( item ) { // update button text - this.button.find( "span.ui-button-text" ).html( item.label ); + this.buttonText.html( item.label ); // change ARIA attr this.menuItems.find("a").attr( "aria-selected", false ); this._getSelectedItem().find("a").attr( "aria-selected", true ); @@ -407,7 +407,6 @@ $.widget( "ui.selectmenu", { this.menu.toggleClass( 'ui-corner-bottom', value ).toggleClass( 'ui-corner-all', !value ); } if ( key === "disabled" ) { - this.button.button( "option", "disabled", value ); this.menu.menu( "option", "disabled", value ); if ( value ) { this.element.attr( "disabled", "disabled" );