From e560194aaa5d3a78b66a0611208a2a2f97380168 Mon Sep 17 00:00:00 2001 From: Richard Worth Date: Sat, 1 Nov 2008 14:49:38 +0000 Subject: [PATCH] Fixed #3193 - Cannot select scrollbars inside dialog in Opera 9.51 --- ui/ui.dialog.js | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/ui/ui.dialog.js b/ui/ui.dialog.js index 87759849a..ff8083a29 100644 --- a/ui/ui.dialog.js +++ b/ui/ui.dialog.js @@ -52,6 +52,9 @@ $.widget("ui.dialog", { uiDialogTitlebar = (this.uiDialogTitlebar = $('
')) .addClass('ui-dialog-titlebar') .append('X') + .mousedown(function() { + self.moveToTop(); + }) .prependTo(uiDialogContainer), title = options.title || ' ', @@ -82,7 +85,7 @@ $.widget("ui.dialog", { }) .ariaRole("dialog") .ariaState("labelledby", titleId) - .mousedown(function() { + .mouseup(function() { self.moveToTop(); }), @@ -92,24 +95,24 @@ $.widget("ui.dialog", { position: 'absolute', bottom: 0 }) - .appendTo(uiDialog); - - this.uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar) - .hover( - function() { - $(this).addClass('ui-dialog-titlebar-close-hover'); - }, - function() { - $(this).removeClass('ui-dialog-titlebar-close-hover'); - } - ) - .mousedown(function(ev) { - ev.stopPropagation(); - }) - .click(function() { - self.close(); - return false; - }); + .appendTo(uiDialog), + + uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar) + .hover( + function() { + $(this).addClass('ui-dialog-titlebar-close-hover'); + }, + function() { + $(this).removeClass('ui-dialog-titlebar-close-hover'); + } + ) + .mousedown(function(ev) { + ev.stopPropagation(); + }) + .click(function() { + self.close(); + return false; + }); uiDialogTitlebar.find("*").add(uiDialogTitlebar).each(function() { $.ui.disableSelection(this); @@ -172,8 +175,12 @@ $.widget("ui.dialog", { maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex); }); (this.overlay && this.overlay.$el.css('z-index', ++maxZ)); - this.uiDialog.css('z-index', ++maxZ); + //Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. + // http://ui.jquery.com/bugs/ticket/3193 + var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') }; + this.uiDialog.css('z-index', ++maxZ); + this.element.attr(saveScroll); this._trigger('focus', null, { options: this.options }); },