Skip to content

Allow disabling autoFocus on sidenav/drawer #10402

Closed

Description

@BobobUnicorn

Bug, feature request, or proposal:

Feature Request

What is the expected behavior?

Automatic focus of initial element in sidenav is controllable

What is the current behavior?

Initial element in sidenav is focused when it opens

What is the use-case or motivation for changing an existing behavior?

Hacks are required to override this behaviour. It's visually distracting when something like a toolbar is in the sidenav and the close button is the first thing focused when it's opened.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Latest

Is there anything else we should know?

API already exists in MatDialog: https://material.angular.io/components/dialog/api#MatDialogConfig

Activity

  1. FernandoX7 commented on Mar 14, 2018

    @FernandoX7

    Care to disclose what hack you are using to disable that behavior? Very annoying as you stated.

    EDIT: Was able to do this to temporarily fix it. Just place above the item that is being auto focused.

         <button mat-button style="height: 0; position: absolute;"> <!-- 'absorbs' the auto-focus behavior -->
          </button>
    
  2. added
    feature
    P4
    on Mar 26, 2018
  3. self-assigned this
    on Apr 20, 2018
  4. added 2 commits that reference this issue on Apr 20, 2018
    f527da7
    ad42f45
  5. added a commit that references this issue on Apr 26, 2018
    4ae63b3
  6. sauravpandit commented on Jun 6, 2019

    @sauravpandit

    Will you please let me know under which version this fix is available?

  7. angular-automatic-lock-bot commented on Sep 10, 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.

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

Metadata

Metadata

Assignees

Labels

P4feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions