Skip to main content

Search and Top Navigation

#7107 closed bug (fixed)

Opened March 13, 2011 03:12AM UTC

Closed October 24, 2012 09:05PM UTC

Dialog: Modal dialog event loss with high zindex child elements (FF 3.6)

Reported by: zbapoc Owned by: zbapoc
Priority: minor Milestone: 1.10.0
Component: ui.dialog Version: 1.8.10
Keywords: modal Cc:
Blocked by: Blocking:
Description

Scenario:

A file input element exists within a modal dialog and is styled for the transparency trick (effectively replace the ugly browse button).

position: absolute;

z-index: 2147483583 (css maximum supported)

In FF3, the problem is that clicking the browse button causes the event to be swallowed so the browse dialog is never displayed. Everything works fine in IE8, but I have not checked other browsers.

Possible Resolution:

After a couple hours of tracking this down, I found where the issue is occurring. In jquery.ui.core.js, line 108 (inside the zIndex() function), the following code parses an incorrect value for large z-indices:

value = parseInt( elem.css( "zIndex" ), 10 );

The reason for this is that elem.css('zIndex') returns '2.14+e9', which gets evaluated to 2 after parseInt().

There are at least two possible resolutions...

1) Use parseFloat() instead.

2) Fix the .css() method to not return scientific notation. I have not dug into the css() method to determine the cause of this.

Attachments (0)
Change History (8)

Changed March 21, 2011 04:38PM UTC by scottgonzalez comment:1

component: ui.coreui.dialog

Changed May 17, 2011 03:31PM UTC by davidmurdoch comment:2

I could not reproduce in FF 3.6.17 or FF 4.0.1 with latest (1.9pre).

Changed September 07, 2011 12:54PM UTC by scottgonzalez comment:3

keywords: → modal

Changed September 15, 2011 09:16PM UTC by bigorangemachine comment:4

_comment0: I have Replicated this. \ \ Firefox 6.0.2. \ \ This is how I have it setup 9 links on a 'results' page. When a user clicks the result 'block' (thumbnail) an non-invasive script launches an ajax call and puts those results into an ajax modal-dialog and opens its. \ \ (pardon the bad coding was trying to debug the problem before I realized it was a browser issue) \ {{{ \ #!div style="font-size: 90%" \ Here's the relevant parts of my code: \ {{{#!js \ \ \ \ jQuery(document).ready(function($) { \ \ \ \ jQuery('.results a.diagThis').each(function(){ \ jQuery(this).click(function(){ \ var target_html="<div class='diagTarget'></div>"; \ var diag_options={ \ dialogClass: 'customClass', \ modal: true, \ draggable:false, \ resizable:false, \ autoOpen: false, \ minHeight: 547, \ width: 900, \ maxHeight: 650, \ maxWidth: 900 \ }; \ \ // ... \ \ var $_this=this; \ jQuery.ajax({ \ context: jQuery($_this), \ type: 'POST', \ url: ajaxurl, \ data: ajax_data, \ success: function(response){ \ jQuery('.diagTarget').html(jQuery(response).find('response object response_data').text());//WORDPRESS XML \ } \ }); \ }); \ }); \ \ \ \ }); \ \ }}} \ }}} \ \ When the user 'clicks' any thumbnail after the first one; none of the links (or any clickable for that matter) will not work within the content area (selector '.ui-dialog-content.ui-widget-content') but you can use the close button within the title bar! \ \ The issue specifically resides with the modal being set to true. I wasn't able to pin-point it in the source code but I was able to discover a simple work around (I don't think this will work if you are animating but try it :)). \ \ {{{ \ #!div style="font-size: 90%" \ A work around I used is to change my options from: \ {{{#!js \ \ var diag_options={ \ dialogClass: 'customClass', \ modal: true, \ draggable:false, \ resizable:false, \ autoOpen: false, \ minHeight: 547, \ width: 900, \ maxHeight: 650, \ maxWidth: 900 \ }; \ }}} \ }}} \ \ \ \ {{{ \ #!div style="font-size: 90%" \ To This: \ {{{#!js \ \ var diag_options={ \ beforeClose: function(){ \ jQuery('.diagTarget').dialog( "option" , 'modal' ,false ); \ }, \ dialogClass: 'customClass', \ modal: true, \ draggable:false, \ resizable:false, \ autoOpen: false, \ minHeight: 547, \ width: 900, \ maxHeight: 650, \ maxWidth: 900 \ }; \ }}} \ }}} \ \ I added to the event handler 'beforeClose' to remove the 'modal' option setting it to false. \ This is jQuery UI 1.8.6, but I verified the issue was also contained within 1.8.16. \ Using jQuery 1.4.4 \ \ Sadly this isn't my site and I wasn't able to track down the issue in the UI source code :(1316121780236554
_comment1: I have Replicated this. \ \ Firefox 6.0.2. \ \ This is how I have it setup 9 links on a 'results' page. When a user clicks the result 'block' (thumbnail) an non-invasive script launches an ajax call and puts those results into an ajax modal-dialog and opens its. \ \ (pardon the bad coding was trying to debug the problem before I realized it was a browser issue) \ {{{ \ #!div style="font-size: 90%" \ Here's the relevant parts of my code: \ {{{#!js \ \ \ \ jQuery(document).ready(function($) { \ \ \ \ jQuery('.results a.diagThis').each(function(){ \ jQuery(this).click(function(){ \ var target_html="<div class='diagTarget'></div>"; \ var diag_options={ \ dialogClass: 'customClass', \ modal: true, \ draggable:false, \ resizable:false, \ autoOpen: false, \ minHeight: 547, \ width: 900, \ maxHeight: 650, \ maxWidth: 900 \ }; \ \ // ... \ \ var $_this=this; \ jQuery.ajax({ \ context: jQuery($_this), \ type: 'POST', \ url: ajaxurl, \ data: ajax_data, \ success: function(response){ \ jQuery('.diagTarget').html(jQuery(response).find('response object response_data').text());//WORDPRESS XML \ } \ }); \ }); \ }); \ \ \ \ }); \ \ }}} \ }}} \ \ When the user 'clicks' any thumbnail after the first one; none of the links (or any clickable for that matter) will not work within the content area (selector '.ui-dialog-content.ui-widget-content') but you can use the close button within the title bar! \ \ The issue specifically resides with the modal being set to true. I wasn't able to pin-point it in the source code but I was able to discover a simple work around (I don't think this will work if you are animating but try it :)). \ \ {{{ \ #!div style="font-size: 90%" \ A work around I used is to change my options from: \ {{{#!js \ \ var diag_options={ \ dialogClass: 'customClass', \ modal: true, \ draggable:false, \ resizable:false, \ autoOpen: false, \ minHeight: 547, \ width: 900, \ maxHeight: 650, \ maxWidth: 900 \ }; \ }}} \ }}} \ \ \ \ {{{ \ #!div style="font-size: 90%" \ To This: \ {{{#!js \ \ var diag_options={ \ beforeClose: function(){ \ jQuery('.diagTarget').dialog( "option" , 'modal' ,false ); \ }, \ dialogClass: 'customClass', \ modal: true, \ draggable:false, \ resizable:false, \ autoOpen: false, \ minHeight: 547, \ width: 900, \ maxHeight: 650, \ maxWidth: 900 \ }; \ }}} \ }}} \ \ I added to the event handler 'beforeClose' to remove the 'modal' option setting it to false. \ This is jQuery UI 1.8.6, but I verified the issue was also contained within 1.8.16. \ Using jQuery 1.4.4 \ \ Sadly this isn't my site and I wasn't able to track down the issue in the UI source code :( \ \ I suspect related to Bug 4800. \ \ I believe it is related to this bug because of this line 267-278 in jquery ui dialog (ver 1.8.16): \ {{{#!js \ if (self.options.modal) { \ maxZ = 0; \ $('.ui-dialog').each(function() { \ if (this !== self.uiDialog[0]) { \ thisZ = $(this).css('z-index'); \ if(!isNaN(thisZ)) { \ maxZ = Math.max(maxZ, thisZ); \ } \ } \ }); \ $.ui.dialog.maxZ = maxZ; \ } \ }}} \ \ I suspect the above as the troublesome lines as the issue seems to be between closing properly and being in modal mode?1316121979437214

I have Replicated this.

Firefox 6.0.2.

This is how I have it setup 9 links on a 'results' page. When a user clicks the result 'block' (thumbnail) an non-invasive script launches an ajax call and puts those results into an ajax modal-dialog and opens its.

(pardon the bad coding was trying to debug the problem before I realized it was a browser issue)

#!div style="font-size: 90%"
Here's the relevant parts of my code:
  {{{#!js



jQuery(document).ready(function($) {



jQuery('.results a.diagThis').each(function(){
	jQuery(this).click(function(){
		var target_html="<div class='diagTarget'></div>";
		var diag_options={
			dialogClass: 'customClass',
			modal: true,
			draggable:false,
			resizable:false,
			autoOpen: false,
			minHeight: 547,
			width: 900,
			maxHeight: 650,
			maxWidth: 900
		};

		// ...

		var $_this=this;
		jQuery.ajax({
			context: jQuery($_this),
			type: 'POST',
			url: ajaxurl, 
			data: ajax_data, 
			success: function(response){
				jQuery('.diagTarget').html(jQuery(response).find('response object response_data').text());//WORDPRESS XML
			}
		});
	});
});



});

  

}}}

When the user 'clicks' any thumbnail after the first one; none of the links (or any clickable for that matter) will not work within the content area (selector '.ui-dialog-content.ui-widget-content') but you can use the close button within the title bar!

The issue specifically resides with the modal being set to true. I wasn't able to pin-point it in the source code but I was able to discover a simple work around (I don't think this will work if you are animating but try it :)).

#!div style="font-size: 90%"
A work around I used is to change my options from:
  {{{#!js

		var diag_options={
			dialogClass: 'customClass',
			modal: true,
			// ...
			maxHeight: 650,
			maxWidth: 900
		};
  

}}}

#!div style="font-size: 90%"
To This:
  {{{#!js

		var diag_options={
			beforeClose: function(){
				jQuery('.diagTarget').dialog( "option" , 'modal' ,false );
			},
			dialogClass: 'customClass',
			modal: true,
			// ...
			width: 900,
			maxHeight: 650,
			maxWidth: 900
		};
  

}}}

I added to the event handler 'beforeClose' to remove the 'modal' option setting it to false.

This is jQuery UI 1.8.6, but I verified the issue was also contained within 1.8.16.

Using jQuery 1.4.4

Sadly this isn't my site and I wasn't able to track down the issue in the UI source code :(

I suspect related to Bug 4800.

I believe it is related to this bug because of this line 267-278 in jquery ui dialog (ver 1.8.16):

		if (self.options.modal) {
			maxZ = 0;
			// ...
			$.ui.dialog.maxZ = maxZ;
		}

I suspect the above as the troublesome lines as the issue seems to be between closing properly and being in modal mode?

Changed October 11, 2012 02:47PM UTC by scottgonzalez comment:5

milestone: 1.9.01.10.0

Changed October 15, 2012 08:32PM UTC by bavanyo comment:6

owner: → zbapoc
status: newpending

Please attach your complete, working test case as we are having trouble recreating your issue.

Changed October 24, 2012 02:29AM UTC by jzaefferer comment:7

summary: Modal dialog event loss with high zindex child elements (FF 3.6)Dialog: Modal dialog event loss with high zindex child elements (FF 3.6)

Changed October 24, 2012 09:05PM UTC by Nate Eagle comment:8

resolution: → fixed
status: pendingclosed

Dialog: Awesome new stacking and overlay implementation. Fixes the following tickets:

Fixes #3534 - Dialog: Modal dialog disables all input elements on page.

Fixes #4671 - Dialog: Modal Dialog disables vertical scroll bar in Chrome & Safari.

Fixes #4995 - Dialog: Modal Dialog's overlay dissapears in IE when content is tall.

Fixes #5388 - Dialog: Don't change z-index when already at the top.

Fixes #5466 - Dialog: "modal" Dialog Incorrectly Cancels Input Events.

Fixes #5762 - Dialog: Get rid of z-index workaround, document it instead.

Fixes #6267 - Dialog: checkboxes that inherit a z-index < jqueryui.dialog z-index don't work.

Fixes #7051 - Dialog: modal prevents tab key from moving focus off slider handle.

Fixes #7107 - Dialog: Modal dialog event loss with high zindex child elements (FF 3.6).

Fixes #7120 - Dialog: Modal operation interrupts drag drop marker functionality on gmaps.

Fixes #8172 - Dialog: Change event cancelled when opening modal dialog from another modal dialog.

Fixes #8583 - Dialog: Mouse event wrongly stopped.

Fixes #8722 - Dialog: Remove stack option.

Fixes #8729 - Dialog: Remove zIndex option.

Changeset: 3829a37ca122e923c3a08b964c4b1a946a2a1456