-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input losing focus when wrapped into label #957
Comments
Would you mind creating a jsbin or a jsfiddle? Just want to make sure I have a full understanding of the problem. |
Sure just took the first example to initialize typeahead.js http://jsfiddle.net/ebii/adw3w3y1/5/ |
btw. the same behaviour worked before commit be9114d |
Are you sure that commit broke it? The problem seems to stem from the fact that the hint element is inserted before the typeahead input, so when you click on the label, it'll try to focus on the hint, not the typeahead input. |
Yes I'm pretty sure. I didn't try on the fiddle but bisected through the commits in my actual project, where it only started to happen after that commit. |
I've noticed the same thing here. Setting hint to false stops the input from losing focus immediately. |
+1 on FF 31 and FF 32.0.3 Chrome not having an issue. I set hint: false to work around. |
My workaround is to back out be9114d after setting up the typeahead. That commit seems to be an IE8/IE9 fix and luckily we're not supporting those: // do typeahead setup, etc., to get it in the DOM, then
var $hint = $("scope>to>typeahead>input.tt-hint");
$hint
.prop("readonly", false)
.prop("disabled", true); Thanks @ebi for the detective work. Nice find. |
Same occurs on iPad. jsbin demo: http://jsbin.com/pejuvajeqi/1/edit?html,js,console,output Keyboard doesn't pop up when wrapped in label. |
Sad that this hasn't been fixed. |
Sad that I still haven't shipped the project I was working on last May when I made the comment above yours. |
Unbelievable there's a bug like this! Drove me crazy for at least half an hour. 2014 when the issue has 1st been raised, still no fix? Sad. To date, still broken, using Safari 11.0 (12604.1.38.1.7) on macOS Sierra (10.12.6). |
Observed on Firefox 31 if the input that gets enhanced with typeahead is wrapped into a
<label>
tag it will focus and blur again right away.The text was updated successfully, but these errors were encountered: