Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#8282 closed enhancement (fixed)

Double escape clear IE form, continue Ticket #7643

Reported by: r2363c Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.19
Keywords: Cc:
Blocked by: Blocking:


On IE, when you double press on escape key it cause a form clear. In current usage it doesn't happen, but when you use the JQuery UI autocompletion it can happen as the escape key is used to cancel autocompletion.

Ticket #7643 raised 9 month ago was closed as it was conclude that it wasn't a JQuery UI bug, and I agree on that. However I think it make sense to integrate a workaround in this component to avoid this side effect on IE.

I've added a comment on the closed ticket, but it seems to be ignored (quite normal on a closed ticket), That's why I open a new ticket with my previous comment.

I suggest to add a preventDefault() call on the keydown.autocomplete handle

Then I suggest to change the code (on minimized version)

case e.ESCAPE:b.element.val(b.term),b.close(c);break;


case e.ESCAPE:b.element.val(b.term),b.close(c);c.preventDefault();break;

I've tested it on IE6&8 and FF11 and chrome15 and it seems to fix the point on IE and to do not cause any trouble on others.

On the last source code (I haven't tested it) it should be

case keyCode.ESCAPE:
  if (":visible") ) {
	self._value( self.term );
	self.close( event );

Hoping it can be integrated on future release of autocomplete.

Change History (4)

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

The suggested fix is definitely not correct. We should absolutely not prevent the default action all the time. We can add it inside the conditional to require three escapes when the menu is open. This will be slightly different from native autocomplete in IE where 1 = break out of autocomplete, 2 = clear field, 3 = clear form. We end up with 1 = break out of autocomplete, 2 = nothing, 3 = clear field.

I still find escape to clear anything kind of strange on the web.

comment:2 in reply to:  1 Changed 11 years ago by r2363c

Hello Scott,

I agree with your suggestion and understand you don't wish to prevent default action from IE (as strange it was). Your suggestion will move the clear form effect from the 2nd escape press to the third, it should significantly reduce the risk of accidental form clear due to a break out of autocomplete, I think it's a good compromise.

Thank you.

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

Resolution: fixed
Status: newclosed

Autocomplete: Prevent the default action on escape when the menu is open. Fixes #8282 - Double escape clear IE form, continue Ticket #7643.

Changeset: 4ab7d53b1cfb4e37e3c098ceddc33597b851a88f

comment:4 Changed 10 years ago by tj.vantoll

#8841 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.