Skip to main content

Search and Top Navigation

#8063 closed bug (fixed)

Opened January 27, 2012 09:34AM UTC

Closed October 16, 2012 01:18PM UTC

Last modified October 16, 2012 01:20PM UTC

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:
Description

See http://jsfiddle.net/Wa5zW/

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 (http://bugs.jqueryui.com/ticket/7472) was rejected, why does "escape" get supported as a special case (which is broken anwyay)?

Attachments (0)
Change History (9)

Changed January 27, 2012 12:37PM UTC by scottgonzalez comment:1

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.

Changed January 27, 2012 12:45PM UTC by tomblench comment:2

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.

Changed January 27, 2012 12:49PM UTC by scottgonzalez comment:3

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.

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

milestone: 1.9.01.10.0

Changed October 15, 2012 03:47PM UTC by dalekocian comment:5

owner: → dalekocian
status: openassigned

Changed October 15, 2012 06:16PM UTC by dalekocian comment:6

resolution: → fixed
status: assignedclosed

Changed October 15, 2012 11:41PM UTC by scottgonzalez comment:7

resolution: fixed
status: closedreopened

Changed October 16, 2012 01:18PM UTC by Dale Kocian comment:8

resolution: → fixed
status: reopenedclosed

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

Changeset: 1a696678878f48748912b4c9d5df6da91c760b98

Changed October 16, 2012 01:20PM UTC by scottgonzalez comment:9

milestone: 1.10.01.9.1