Skip to content

MatTabNavBar: space key does not activate the selected tab #19642

@nirkai

Description

@nirkai

Reproduction

Without router-outlet directive

The mat-tab-nav-bar directive not activate tabs with Enter&Space by default (like in 'real' tabs).

Official example (without router-outlet).

Steps to reproduce:

  1. Focus on unselected tab (with arrow keys) and press Enter or Space
  2. The selected tab not activated and the route page isn't display.
With router-outlet directive

The mat-tab-nav-bar directive with routerLink (like shown here) activate selected tabs with Enter but not with Space.

Custom example (with router-outlet).

Steps to reproduce:

  1. Focus on unselected tab and press Enter.
  2. The selected tab activated.
  3. Focus on unselected tab and press Space.
  4. The selected tab not activated and the route page isn't display.

Expected Behavior

Select tabs with Enter or Space keys will activate the selected tab.

There is also a function call that should handle it. here is the call and here is the function.

Actual Behavior

When tab selected by Space the route not activated.

Environment

  • Angular: 9
  • CDK/Material: 9.2.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    AccessibilityThis issue is related to accessibility (a11y)P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/tabsdesignThis issue needs design work before implementingneed a11y consultTeam needs to consult with an accessibility expert before proceeding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions