Skip to content

Focus is lost when opening md-select options list #6690

Closed

Description

@rubenlagus

Bug, feature request, or proposal:

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 are the steps to reproduce?

Check focus log when selecting options: http://plnkr.co/uySEJGxzMTkbO6DxlT1F

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.

Activity

  1. rubenlagus commented on Sep 1, 2017

    @rubenlagus
    Author

    Update:
    It is still happening with latest beta 2.0.0-beta.10 and Angular 4.3.6

  2. willshowell commented on Sep 1, 2017

    @willshowell
    Contributor

    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?

  3. rubenlagus commented on Sep 4, 2017

    @rubenlagus
    Author

    @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.

  4. willshowell commented on Sep 5, 2017

    @willshowell
    Contributor

    I see, cc @crisbeto

  5. crisbeto commented on Sep 5, 2017

    @crisbeto
    Member

    I'm currently working on switching md-select to use aria-activedescendant instead of moving focus. This shouldn't be an issue once it is in place.

  6. self-assigned this
    on Sep 5, 2017
  7. added 2 commits that reference this issue on Sep 5, 2017
    14f5414
    1f992ae
  8. added 5 commits that reference this issue on Sep 13, 2017
    624ddff
    23a5494
    a518536
    26fd20e
    6ea8424
  9. added a commit that references this issue on Oct 3, 2017
    b5ada20
  10. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  11. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions