angular-ui / ui-select

AngularJS-native version of Select2 and Selectize
MIT License
3.26k stars 1.82k forks source link

Focus on input when clicking label-tag with for attribute only works for multiple #1912

Open gabbsmo opened 7 years ago

gabbsmo commented 7 years ago

Bug description:

According PR #1220 I can specify the input-id attribute on ui-select and that attribute value will be reflected in the input tag's id attribute. This logic itself works but focusing does not in Google Chrome at least.

When I click the label I expect the cursor to be moved inside the input field.

Link to minimally-working plunker that reproduces the issue:

Multiple select (works) Single select (doesn't work) Plain html (Clicking label sets focus to select box and I can use keyboard to select value)

Version of Angular, UI-Select, and Bootstrap/Select2/Selectize CSS

Angular: 1.5 UI-Select: 0.19.5

Jefiozie commented 7 years ago

Looks like a valid bug to me. Could you investigate and make a PR?

gabbsmo commented 7 years ago

Would hijacking the click event of the label element corresponding to the ui-select directive and set focus on ui-select programatically be a acceptable solution?

As I understand it the relationship between label's and input's id attribute a non standard to begin with.

xhoskin commented 7 years ago

+1