Autocomplete dumps focus to body when selecting via mouse
Bug, feature request, or proposal:
When selecting an option using the keyboard, the host input does not blur on selection. However, when selecting an option using the mouse, the host input blurs.
What is the expected behavior?
As the MdSelect does not blur on clicking an option or selecting via the keyboard, I think that clicking should probably not blur the input. Or at least, the option for specifying the behavior should be present.
What is the current behavior?
The input blurs on click but not on keyboard selection.
What are the steps to reproduce?
The example plunks for the MdAutoComplete and the MdSelect show their corresponding behaviour. https://plnkr.co/edit/ASQ9jmd8h5Y13kyD2wRI
What is the use-case or motivation for changing an existing behavior?
Bringing MdSelect and MdAutocomplete behavior into alignment
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 4.x, Material Beta 3.
Is there anything else we should know?
I'm not sure if this helps, but I can see a preventDefault in the keyboard event handling in MdAutoComplete here: https://github.com/angular/material2/blob/master/src/lib/autocomplete/autocomplete-trigger.ts#L236
This could be why the keyboard is not blurring the input?
TL;DR: if you use the mouse to select an autocomplete option, focus is dumped back to <body>, which is a bad a11y bug. Can be seen on the docs site.
Thanks for the quick fix, much appreciated!
@iblocks-Xander Did you actually get this to work? I'm on 8.0.0 beta.2 and the issue still seems to be occurring for me...
The fix that was added in pull #4702 worked for me. This issue was closed about 2 years ago, so if you are experiencing something similar, I'd suggest opening a new issue with a reproduction.
@iblocks-Xander
I opened a new issue and created a quick stack blitz, I was wondering if you could look at it and confirm thats what you were having issues with...just curious..
https://github.com/angular/components/issues/15914
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.