Fixed #3193 - Cannot select scrollbars inside dialog in Opera 9.51

This commit is contained in:
Richard Worth 2008-11-01 14:49:38 +00:00
parent 8ce1db36db
commit e560194aaa

View File

@ -52,6 +52,9 @@ $.widget("ui.dialog", {
uiDialogTitlebar = (this.uiDialogTitlebar = $('<div/>')) uiDialogTitlebar = (this.uiDialogTitlebar = $('<div/>'))
.addClass('ui-dialog-titlebar') .addClass('ui-dialog-titlebar')
.append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>') .append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>')
.mousedown(function() {
self.moveToTop();
})
.prependTo(uiDialogContainer), .prependTo(uiDialogContainer),
title = options.title || '&nbsp;', title = options.title || '&nbsp;',
@ -82,7 +85,7 @@ $.widget("ui.dialog", {
}) })
.ariaRole("dialog") .ariaRole("dialog")
.ariaState("labelledby", titleId) .ariaState("labelledby", titleId)
.mousedown(function() { .mouseup(function() {
self.moveToTop(); self.moveToTop();
}), }),
@ -92,24 +95,24 @@ $.widget("ui.dialog", {
position: 'absolute', position: 'absolute',
bottom: 0 bottom: 0
}) })
.appendTo(uiDialog); .appendTo(uiDialog),
this.uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar) uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar)
.hover( .hover(
function() { function() {
$(this).addClass('ui-dialog-titlebar-close-hover'); $(this).addClass('ui-dialog-titlebar-close-hover');
}, },
function() { function() {
$(this).removeClass('ui-dialog-titlebar-close-hover'); $(this).removeClass('ui-dialog-titlebar-close-hover');
} }
) )
.mousedown(function(ev) { .mousedown(function(ev) {
ev.stopPropagation(); ev.stopPropagation();
}) })
.click(function() { .click(function() {
self.close(); self.close();
return false; return false;
}); });
uiDialogTitlebar.find("*").add(uiDialogTitlebar).each(function() { uiDialogTitlebar.find("*").add(uiDialogTitlebar).each(function() {
$.ui.disableSelection(this); $.ui.disableSelection(this);
@ -172,8 +175,12 @@ $.widget("ui.dialog", {
maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex); maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex);
}); });
(this.overlay && this.overlay.$el.css('z-index', ++maxZ)); (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 }); this._trigger('focus', null, { options: this.options });
}, },