#6635 closed bug (notabug)
focus is broken after selecting
Reported by: | shigella | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | ui.autocomplete | Version: | 1.8.6 |
Keywords: | focus | Cc: | |
Blocked by: | Blocking: |
Description
when bind a focus on a textfield and then after selecting an item the focus of the textfield is broken..
only after blur (clicking on a blank area of the form) you are able to focus again
Change History (8)
comment:1 Changed 12 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 Changed 12 years ago by
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
i mean when selecting an item and you want to do a search again the text in the textfield remains in place
so if you first do this:
$j('#field').focus(function(){
$j(this).val();
});
$j('#investigator').autocomplete({
minLength: 2, source: function(request, response) {...},
select: function(event, ui) {
at this moment you choose an item. if you do search immediately again the focus is broken and your selected text is not removed from the textfield. the following does not fix the problem
$j('#field).bind('focus');
}
});
comment:3 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
I'm not sure why you would bind to focus again inside the select event. Anyway, you can prevent the selection and clear the field. The plugin is working properly. If you need help with your specific use case, please use the forums.
comment:4 Changed 12 years ago by
it's for sure a bug..i don't think you understand the problem
--- "I'm not sure why you would bind to focus again inside the select event."
Because for some reason the focus which set earlier is broken after the select event
"Anyway, you can prevent the selection and clear the field. "
This is posibble with the focus: function(event, ui) { ... } set to false. But that's not the issue
After selecting an item the item text is set into the textfield. Focus (with the mouse) immediately in the textfield and do a search again is not possible because the text will remain in the textfield. The only way to do a search is to select the text and del or backspace it. But as i mentioned earlier: this must be done with the earlier :
$j('#field').focus(function(){
$j(this).val(' ');
});
But thats broken by the autocomplete select event
comment:5 Changed 12 years ago by
The original focus event handler is not broken at all after the select event. Returning false in the focus event has nothing to do with preventing the selection from the menu.
This is exactly what I'm talking about: http://jsbin.com/isate/edit
comment:6 Changed 12 years ago by
please try:
select an item and go directly to the input field with your mouse to do a search again without clicking on the blank document(blur).
Result: the focus is broken
(i removed the "$( this ).val( "" );" from the select event, because the selected item (text) must be visible in the input field
comment:7 Changed 12 years ago by
There's nothing broken about that. The text field already has focus, so clicking it again does nothing. Please stop commenting on this ticket.
I'm not sure what you mean, the text field instantly regains focus after selecting an item from the menu.