#5365 closed bug (duplicate)
ESC key problem
Reported by: | fredericomf | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.9.0 |
Component: | ui.dialog | Version: | 1.8rc3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When i created two modal dialogs using UI the second dialog don't listen the ESC key event.
This is the structure of modal dialogs:
<div id="modal01"> Some Text <a id="showSecondDialog">NEW</a> <div id="modal02"> Some Text </div> </div>
Both dialogs has option: autoOpen: false.
The trigger to show the second dialog is a button inside a first dialog.
Pressing ESC key the first dialog is closed and the second don't close.
Change History (4)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
The problem here is that we only bind the 'keydown.dialog-overlay' event once and for the first overlay created (so for the first modal dialog). The fix is to still only bind the event once but have the event search the instances for the 'top' overlay (by zIndex) and close it's dialog. This also necessitates the overlay having a back reference to it's dialog but that is easy to do.
Note that there is a second bug lurking here that hitting escape with the focus in the second dialog would close both dialogs. First you close the top dialog and then the ESCAPE keydown event propagates to the overlay and closes the next dialog. Simple fix is to stop the event propagating.
Both fixes and visual test case are in these commits (second is useful comments):
comment:3 Changed 12 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Step:
See:
jQuery UI 1.8.1 Uncompressed version
jquery.ui.dialog.js
line 702 (overlay create)
line 72 (dialog _create)
line 683 (overlay create)
Problem:
in line 702, "dialog" means "the first dialog".