angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.29k stars 6.73k forks source link

Fix issue where focus is stolen from form elements after dropdown shown #6369

Closed mondayuk closed 7 years ago

mondayuk commented 7 years ago

Discovered an issue where form elements were losing their focus. Discovered this was related to #5934 having added a feature to apply the focus to the toggle element, but as this event fires on all mouse clicks the focus was being set regardless of whether the dropdown was actually open at the time.

wesleycho commented 7 years ago

I believe this was originally added for accessibility reasons - does this preserve the accessibility situation denoted in #5782?

mondayuk commented 7 years ago

Yes, the functionality is preserved when the popup closes (which is the intention of the fix) but it resolves the issue that the focus continues to be reverted back to the toggle control even after the popup has been closed.

This issue can be seen on https://angular-ui.github.io/bootstrap/. Click to open the dropdown then close, then try and focus on something else on the page (for example, one of the text boxes next to the date pickers) focus is pulled back to the dropdown.

dougludlow commented 7 years ago

FYI, @lukehutton added e07f9fd to #6353 to fix the same issue.

mondayuk commented 7 years ago

Looks like that was done after mine and (unless i'm mistaken) has no pull request yet. Functionally identical though.

mondayuk commented 7 years ago

Oh actually, I see it is associated with a pull request. No preference on which makes it in.

wesleycho commented 7 years ago

Going to close this as I merged #6382 instead as the proper fix - thanks for the attempt, the fix should be in the latest release.