Search Input - Focus problem #1459

ChadMC opened this Issue Apr 15, 2011 · 2 comments


None yet

5 participants

ChadMC commented Apr 15, 2011

If you type something inside a search input textbox then press the "X" to clear the textbox, this clears the text and enables you to begin typing again. That part works fine.

If you already have something typed in the search input and are not focused inside of it or focused on something else then press the "X", the textbox is cleared but focus is not given back to the textbox, even though the textbox is highlighted.

This actually works fine in Google Chrome and Firefox. But it does not work on iPhone or Android.


Ah, that would be a nice touch. We'll add this focus tweak.

@gseguin gseguin was assigned Aug 8, 2011
sramam commented Sep 21, 2011

seems this had to do with the change event being triggered.
setting a focus after a timeout seems to solve the problem atleast on an iPad.
(Diff taken on 1.0b1)

-                                       input.val('').focus();
-                                       input.trigger('change');
+                                         input.val('').trigger('change');
+                                         setTimeout(function(){input.focus()}, 50);
@Wilto Wilto was assigned Feb 15, 2012
@Wilto Wilto added a commit that closed this issue Mar 3, 2012
@Wilto Wilto Fixes #1459 — Clicking on a search input’s “clear” button now returns…
… focus to the search input.
@Wilto Wilto closed this in cbe4320 Mar 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment