Skip to main content

Search and Top Navigation

#4652 closed bug (fixed)

Opened July 02, 2009 01:55AM UTC

Closed November 19, 2010 02:03PM UTC

Last modified December 08, 2010 06:35PM UTC

Dialog: Event loss in subsequent dialog calls (FF3)

Reported by: rlandrum Owned by:
Priority: minor Milestone: 1.8.7
Component: ui.dialog Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

I recently had (I fixed it) an issue with Modal dialogs.

I have defined in my application two modals. Each has a text editable form field. When I open one of the modals, and close it (a close event handler calls .dialog('destroy')), any additional modals I open have no events.

I tracked this (over several hours, sadly) to the overlay. All of my events were being blocked by the overlay, even though my modal was on top. This is because the zIndex for the overlay was 'NaN'. 'NaN' is greater than the zIndex of the modal and the end result is that the keypress and other event handlers from the overlay block the keypress handlers from the modal.

The overlay, as it turns out, is getting NaN from the dialog. Once a dialog is closed, it attempts to find the largest zIndex of all the .ui-dialog classed DOM objects. Unfortunately, this is done with

$(this).css('z-index')

Which in FF3 returns 'auto' for non-zIndexed objects with the .ui-dialog class. (Don't ask why I have ui-dialog classed objects.)

The fix is pretty simple,

Replace:

maxZ = Math.max(maxZ, $(this).css('z-index'));

With:

var i = $(this).css('z-index');

if(!i.isNaN()) {

maxZ = Math.max(maxZ,i);

}

Attachments (0)
Change History (6)

Changed July 03, 2009 09:23PM UTC by scottgonzalez comment:1

milestone: TBD1.8

Changed December 18, 2009 05:26PM UTC by dalexandre comment:2

Thanks A LOT dude :-)

In fact the bug can be fixed by adding

.ui-dialog
{
  z-index: 0;
}

In your CSS (so no need to patch the code). That way all the .ui-dialog HAVE a default z-index not set to "auto".

I was having HUGE issues in a big webapp with a lot of .ui-dialog class set.

Changed November 16, 2010 03:46PM UTC by jamiejag comment:3

I've tried to make a correction to the source. Haven't done this before and there are a lot of hoops to jump through. Hopefully it will take.

https://github.com/jquery/jquery-ui/pull/43

Changed November 19, 2010 02:00PM UTC by scottgonzalez comment:4

summary: Event loss in subsequent dialog calls (FF3)Dialog: Event loss in subsequent dialog calls (FF3)

Changed November 19, 2010 02:03PM UTC by jamiejag comment:5

resolution: → fixed
status: newclosed

Dialog: Ensure dialogs have a z-index when calculating the max z-index. Fixex #5955 - Dialog: Closing UI dialog when z-index is not defined in any .ui-dialog class, causes NaN to be used as Z-index, throwing an error. Fixes #4652 - Dialog: Event loss in subsequent dialog calls (FF3).

Changeset: 8bb412dd4a09d66d0f4a5456410a647e3db38bcc

Changed December 08, 2010 06:35PM UTC by scottgonzalez comment:6

milestone: 1.91.8.7