GoogleChrome / dialog-polyfill

Polyfill for the HTML dialog element
BSD 3-Clause "New" or "Revised" License
2.45k stars 245 forks source link

Dialog's overlay stacks over dialog #116

Closed guilhermependezza closed 7 years ago

guilhermependezza commented 7 years ago

The contents of dialog was inaccessible because dialog's overlay were on top dialog and by passing z-index rules.

The solution I've used to get the dialog working was add a display block to _dialog_overlay class.

I'm running this on Firefox 49.0 screenshot from 2016-10-20 15-08-54

samthor commented 7 years ago

I'm confused. The overlay should be behind the dialog, even in your example: the overlay has z-index 100000, and the dialog has 100002.

tartinesKiller commented 7 years ago

Same problem here, with Firefox 50. Using Chrome, no problem.

samthor commented 7 years ago

@tartinesKiller can you try the version at HEAD?

Also, see my earlier comment. The overlay with z-index 100k is smaller than 100k + 2.

(Chrome is moot: it has native dialog support).

samthor commented 7 years ago

& is the dialog a child of something with its own stacking context?

tartinesKiller commented 7 years ago

Does not change anything, same problem. Yes, I know, and that's why it driving me mad, that's not supposed to occur I'm using Material Design Lite, but it doesn't seems to have any z-index superior to 100k.

When trying the codepen here : http://codepen.io/Garbee/full/EPoaMj/, it just works. Maybe it's a problem with mdl ?

vladimir-s commented 7 years ago

@tartinesKiller Same problem. But this is not a problem with mdl. If you move the dialog tag to the same DOM tree level as the overlay, the problem will be fixed.

manico commented 7 years ago

There is a similar problem in Chrome (native dialog) as it is not possible to place anything above dialog. See this example with recaptcha: https://s30.postimg.org/lz5wao3z5/recaptcha.png

Is there a solution for this?

samthor commented 7 years ago

@manico Dialog is in the top layer, so in the native implementation, it should be impossible to place things above it. In the polyfill, it's possible but not suggested.

samthor commented 7 years ago

Closing this as it's related to incorrect use of stacking context. We now warn if you're making a mistake, and also are more permissive, so incorrect usage might still work: #131