Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#7643 closed bug (worksforme)

Clears the selection in all controls

Reported by: jesus.altamir Owned by: jesus.altamir
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.15
Keywords: Cc:
Blocked by: Blocking:

Description

When a page is placed over a textbox(ASP.NET) with autocomplete functionality, pressing the escape key a second time clears all previous selections in the textbox

Change History (8)

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

Owner: set to jesus.altamir
Status: newpending

Please provide more detail and a reduced (non-ASP) example.

comment:2 in reply to:  1 Changed 12 years ago by jesus.altamir

Status: pendingnew

Replying to scott.gonzalez:

Please provide more detail and a reduced (non-ASP) example.

What happens is that I wanted to implement a project of jQuery in ASP.NET, so I started looking online and found an example of how to implement it, there all good, but when I put on one page 2 textbox happens that I do the search in each of them and when I press the escape key once more will clear all the textboxs to which he added auto-complete functionality. The example right out of the page: http://www.esasp.net/2010/03/autocomplete-jquery-ui-en-aspnet.html

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

Resolution: worksforme
Status: newclosed

comment:4 in reply to:  3 Changed 12 years ago by jesus.altamir

Replying to scott.gonzalez:

Works fine for me: http://jsbin.com/adicaq/edit#javascript,html

I just uploaded the example to a url that will end the message, I do the search in both textbox by entering the text "MA", select any of the list, once the two are already selected by pressing the escape 2 times and I clears the text of both.

http://aspspider.info/jesusaltamir/

comment:5 Changed 12 years ago by Scott González

1) No it doesn't.

2) Stop using a really old RC.

comment:6 in reply to:  5 Changed 12 years ago by jesus.altamir

Replying to scott.gonzalez:

1) No it doesn't.

2) Stop using a really old RC.

I just changed the rc for the jquery-ui-1.8.15.custom.min.js the link above, I tested the 2 browsers (IE8 and Google Chrome) and the second does not get this error.

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

There's some crazy behavior going on in that page with the escape button that has nothing to do with jQuery UI. Try pressing escape over and over. The value in the input will come and go.

comment:8 in reply to:  7 Changed 11 years ago by r2363c

Hello,

I've just met the same issue, I develop on WEB for over a decade and I've just discovered that a double press on escape clear the entire form. Then I agree it's not due to JQuery UI.

However, the ESC behavior to close the listbox is the cause of the double press on escape key then I think it could make sense that this widget help to protect users.

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;

by

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 ( self.menu.element.is(":visible") ) {
	self._value( self.term );
	self.close( event );
    }
  event.preventDefault();
 break;

Hoping it can be integrated on future release of autocomplete.

jesus.altamir perhaps you should reopen this ticket to have this reply reported to dev team.

Note: See TracTickets for help on using tickets.