Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#8063 closed bug (fixed)

Escape closes incorrect dialog

Reported by: tomblench Owned by: dalekocian
Priority: minor Milestone: 1.9.1
Component: ui.dialog Version: 1.8.17
Keywords: Cc:
Blocked by: Blocking:



Expected behaviour: topmost dialog is closed when escape is pressed

Actual behaviour: only dialog 2 is closed (last dialog created)

More information: In the presence of multiple dialogs, escape should close the topmost dialog. In the jsfiddle above, if dialog 1 is focussed and dragged over the top of dialog 2, the user would expect dialog 1 to be closed by hitting escape, as it is the topmost dialog.

Additionally, once dialog 2 is closed, dialog 1 is never closed by hitting escape.

Relationship to other bugs: either this feature should work properly or should be dropped. Considering that a feature request for shortcut keys in dialogs ( was rejected, why does "escape" get supported as a special case (which is broken anwyay)?

Change History (9)

comment:1 Changed 11 years ago by Scott González

Status: newopen

This is a bug in the drag behavior. When you drag dialog 1, the dialog is not getting focused. This likely happens because draggable calls event.preventDefault() in mousedown. Click anywhere else in dialog 1 and you'll see it working correctly.

comment:2 Changed 11 years ago by tomblench

Thanks for the feedback.

If I click on Dialog 1 and hit escape, it does indeed close. However, hitting escape again does not cause Dialog 2 to close. Dialog 2 will only close if it is clicked on.

It's a bit of a dangerous thing to second-guess users' expectations, but I think it would be reasonable for the next dialog in the z-order to be focused once the top dialog is closed.

I understand this might seem like an obscure corner case, but jQuery UI allows multiple dialogs to be open, so they should be handled correctly. Also, it's reasonable for an application to have 2 or more dialogs open, such as a warning dialog which pops up on top of a dialog which is used to fill in preferences, etc.

comment:3 Changed 11 years ago by Scott González

Yes, it's definitely reasonable to have multiple dialogs open. We should be doing whatever native desktop dialogs do. Focus should probably jump to whatever element was previously focused.

comment:4 Changed 10 years ago by Scott González


comment:5 Changed 10 years ago by dalekocian

Owner: set to dalekocian
Status: openassigned

comment:6 Changed 10 years ago by dalekocian

Resolution: fixed
Status: assignedclosed

comment:7 Changed 10 years ago by Scott González

Resolution: fixed
Status: closedreopened

comment:8 Changed 10 years ago by Dale Kocian

Resolution: fixed
Status: reopenedclosed

Dialog: Added mousedown event handler on dialog title to focus. Fixed #8063 - Dialog: Escape closes incorrect dialog.

Changeset: 1a696678878f48748912b4c9d5df6da91c760b98

comment:9 Changed 10 years ago by Scott González

Note: See TracTickets for help on using tickets.