From 61e0aeac7e626df711e7066f27b652602387b784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 29 Jul 2010 20:56:28 -0400 Subject: [PATCH] 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. --- tests/unit/dialog/dialog_options.js | 2 +- themes/base/jquery.ui.dialog.css | 3 ++- ui/jquery.ui.dialog.js | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/unit/dialog/dialog_options.js b/tests/unit/dialog/dialog_options.js index cda16aadcdb..fb6a28e12f8 100644 --- a/tests/unit/dialog/dialog_options.js +++ b/tests/unit/dialog/dialog_options.js @@ -43,7 +43,7 @@ test("buttons", function() { i++; }); - ok(btn.parent().hasClass('ui-dialog-buttonpane'), "buttons in container"); + ok(btn.parent().hasClass('ui-dialog-buttonset'), "buttons in container"); btn.trigger("click"); var newButtons = { diff --git a/themes/base/jquery.ui.dialog.css b/themes/base/jquery.ui.dialog.css index 0ad55e9cad5..0354644473f 100644 --- a/themes/base/jquery.ui.dialog.css +++ b/themes/base/jquery.ui.dialog.css @@ -15,6 +15,7 @@ .ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } .ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } .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; } -.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; } +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } +.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } .ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } .ui-draggable .ui-dialog-titlebar { cursor: move; } diff --git a/ui/jquery.ui.dialog.js b/ui/jquery.ui.dialog.js index ae96b2d8b9a..df11e2190a1 100644 --- a/ui/jquery.ui.dialog.js +++ b/ui/jquery.ui.dialog.js @@ -342,7 +342,10 @@ $.widget("ui.dialog", { 'ui-dialog-buttonpane ' + 'ui-widget-content ' + 'ui-helper-clearfix' - ); + ), + uiButtonSet = $( "
" ) + .addClass( "ui-dialog-buttonset" ) + .appendTo( uiDialogButtonPane ); // if we already have a button pane, remove it self.uiDialog.find('.ui-dialog-buttonpane').remove(); @@ -357,7 +360,7 @@ $.widget("ui.dialog", { var button = $('') .text(name) .click(function() { fn.apply(self.element[0], arguments); }) - .appendTo(uiDialogButtonPane); + .appendTo(uiButtonSet); if ($.fn.button) { button.button(); }