aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2016-03-30 11:38:34 -0400
committerScott González <scott.gonzalez@gmail.com>2016-03-30 11:53:28 -0400
commitbff8277fbc885bf2dc0461ac706d2f2bb7035ad6 (patch)
treec037803096190ced1cd806a15580dc2de94847c7
parentbf5d6f314b3798094efdca4b73e09233f2a69d7d (diff)
downloadjquery-ui-bff8277fbc885bf2dc0461ac706d2f2bb7035ad6.tar.gz
jquery-ui-bff8277fbc885bf2dc0461ac706d2f2bb7035ad6.zip
Selectmenu: Prepend icon and move overflow to text span
Fixes #14938 Closes gh-1685
-rw-r--r--tests/unit/selectmenu/core.js2
-rw-r--r--themes/base/selectmenu.css8
-rw-r--r--ui/widgets/selectmenu.js5
3 files changed, 9 insertions, 6 deletions
diff --git a/tests/unit/selectmenu/core.js b/tests/unit/selectmenu/core.js
index 3c2b4936d..5fd47d7f1 100644
--- a/tests/unit/selectmenu/core.js
+++ b/tests/unit/selectmenu/core.js
@@ -21,7 +21,7 @@ test( "markup structure", function( assert ) {
assert.lacksClasses( button, "ui-selectmenu-button-open ui-selectmenu-open" );
assert.hasClasses( menuWrap, "ui-selectmenu-menu" );
assert.lacksClasses( menuWrap, "ui-selectmenu-menu-open" );
- assert.strictEqual( icon[ 0 ], button.children().last()[ 0 ], "Icon is last child of button" );
+ assert.strictEqual( icon[ 0 ], button.children()[ 0 ], "Icon is first child of button" );
} );
asyncTest( "accessibility", function() {
diff --git a/themes/base/selectmenu.css b/themes/base/selectmenu.css
index 65a2adfbf..3299f9e4d 100644
--- a/themes/base/selectmenu.css
+++ b/themes/base/selectmenu.css
@@ -33,10 +33,14 @@
.ui-selectmenu-open {
display: block;
}
-.ui-selectmenu-button.ui-button {
- text-align: left;
+.ui-selectmenu-text {
+ display: block;
+ margin-right: 20px;
overflow: hidden;
text-overflow: ellipsis;
+}
+.ui-selectmenu-button.ui-button {
+ text-align: left;
white-space: nowrap;
width: 14em;
}
diff --git a/ui/widgets/selectmenu.js b/ui/widgets/selectmenu.js
index fa7f87e94..87f88623f 100644
--- a/ui/widgets/selectmenu.js
+++ b/ui/widgets/selectmenu.js
@@ -119,11 +119,10 @@ return $.widget( "ui.selectmenu", [ $.ui.formResetMixin, {
this._addClass( this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
"ui-button ui-widget" );
- this.buttonItem = this._renderButtonItem( item )
- .appendTo( this.button );
-
icon = $( "<span>" ).appendTo( this.button );
this._addClass( icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button );
+ this.buttonItem = this._renderButtonItem( item )
+ .appendTo( this.button );
if ( this.options.width !== false ) {
this._resizeButton();