Skip to content

Commit 61e0aea

Browse files
committed
Dialog: Wrap buttons in a div so we can float the div instead of the individual buttons. Fixes #4529 - dialog buttons are accessed in wrong order using tab.
1 parent f00c031 commit 61e0aea

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

tests/unit/dialog/dialog_options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ test("buttons", function() {
4343
i++;
4444
});
4545

46-
ok(btn.parent().hasClass('ui-dialog-buttonpane'), "buttons in container");
46+
ok(btn.parent().hasClass('ui-dialog-buttonset'), "buttons in container");
4747
btn.trigger("click");
4848

4949
var newButtons = {

themes/base/jquery.ui.dialog.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
1616
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
1717
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
18-
.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; }
18+
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
19+
.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
1920
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
2021
.ui-draggable .ui-dialog-titlebar { cursor: move; }

ui/jquery.ui.dialog.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,10 @@ $.widget("ui.dialog", {
342342
'ui-dialog-buttonpane ' +
343343
'ui-widget-content ' +
344344
'ui-helper-clearfix'
345-
);
345+
),
346+
uiButtonSet = $( "<div></div>" )
347+
.addClass( "ui-dialog-buttonset" )
348+
.appendTo( uiDialogButtonPane );
346349

347350
// if we already have a button pane, remove it
348351
self.uiDialog.find('.ui-dialog-buttonpane').remove();
@@ -357,7 +360,7 @@ $.widget("ui.dialog", {
357360
var button = $('<button type="button"></button>')
358361
.text(name)
359362
.click(function() { fn.apply(self.element[0], arguments); })
360-
.appendTo(uiDialogButtonPane);
363+
.appendTo(uiButtonSet);
361364
if ($.fn.button) {
362365
button.button();
363366
}

0 commit comments

Comments
 (0)