You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Focus is lost when opening md-select options list #6690
When an user opens the md-select options list, focus is lost from the component itself.
What is the expected behavior?
Focus should remain in a child of md-select options and events such as focusin or focusout should not be triggered since the user has not really leave the component at tall.
What is the current behavior?
As soon as the options list opens, focus is lost form the component containing the md-select.
What is the use-case or motivation for changing an existing behavior?
In order to be able to track focus events and being able to apply custom styles to a component when it is focused, it is necessary that those events allow to track when the user really leave the component and they don't trigger while the user is selecting an option inside a form (for example).
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Tested with Angular 4.3.1, Material 2.0.0-beta.8 under Chrome.
Focus moves to the select options which, in the DOM, are in an overlay at the end of the body. What if the select component had a class like mat-select-open when the panel was open?
@willshowell in my use case, I'm using a directive that use focusin and focusout events to add/remove styles to the whole component. I could add a workaround to those event that also check if the mat-select-open is present.
I would prefer to get those event only when the actual focus is indeed moved away from the component (and yes, I know that internally in the DOM it is like that).
What about trying to avoid the event to bubble out of the md-select?
P.S: I can provide the Directive code in case it is needed.
Activity
rubenlagus commentedon Sep 1, 2017
Update:
It is still happening with latest beta 2.0.0-beta.10 and Angular 4.3.6
willshowell commentedon Sep 1, 2017
Focus moves to the select options which, in the DOM, are in an overlay at the end of the body. What if the select component had a class like
mat-select-openwhen the panel was open?rubenlagus commentedon Sep 4, 2017
@willshowell in my use case, I'm using a directive that use focusin and focusout events to add/remove styles to the whole component. I could add a workaround to those event that also check if the
mat-select-openis present.I would prefer to get those event only when the actual focus is indeed moved away from the component (and yes, I know that internally in the DOM it is like that).
What about trying to avoid the event to bubble out of the
md-select?P.S: I can provide the Directive code in case it is needed.
willshowell commentedon Sep 5, 2017
I see, cc @crisbeto
crisbeto commentedon Sep 5, 2017
I'm currently working on switching
md-selectto usearia-activedescendantinstead of moving focus. This shouldn't be an issue once it is in place.refactor(select): use aria-activedescendant to manage focus
refactor(select): use aria-activedescendant to manage focus
refactor(select): use aria-activedescendant to manage focus
refactor(select): use aria-activedescendant to manage focus
refactor(select): use aria-activedescendant to manage focus
refactor(select): use aria-activedescendant to manage focus
refactor(select): use aria-activedescendant to manage focus
refactor(select): use aria-activedescendant to manage focus (#6856)
angular-automatic-lock-bot commentedon Sep 7, 2019
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.