views:

356

answers:

2

It looks like there is a bug in jQuery UI Dialog where there closeOnEscape doesn't work properly, such that escape will still close the dialog. One possible solution is to unbind the keydown on the overlay, but this doesn't seem to work.

Is there another solution that works?

Here is the link for bug and fix for 1.6, but 1.5.3 is still broken: http://dev.jqueryui.com/ticket/3253

A: 

Seems a pretty simple patch to backport - it's just wrapping

if (options.closeOnEscape) { }

around

(e.keyCode && e.keyCode == $.keyCode.ESCAPE && dialog.close());
TML
+1  A: 

This bug has since been fixed (in 1.6b): http://jqueryui.com/docs/Changelog/1.6

Updating to the latest jQuery UI release should resolve this issue. In the latest relase (1.8.2 as of the time of this answer) it works in all browsers without any issues.

Nick Craver