Skip to content

bug(tabs): When using "mat-tab-nav-bar" selecting a tab with SPACE will scroll the page #28392

@mirobo

Description

@mirobo

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

This is an issue since at least version 16 and its also present in 17+. I guess it has been there for a long time..

When using "mat-tab-nav-bar" and when hitting SPACE to select a tab, the page will scroll. When using ENTER it works fine.
I guess we should also preventDefault when hitting SPACE?

mat-tabs

Reproduction

  1. https://material.angular.io/components/tabs/overview#tabs-and-navigation
  2. Click "view full example"
  3. Focus one of the tabs and select a tab with arrow keys
  4. Hit SPACE to activate a tab

Expected Behavior

  1. Page will not scroll down

Actual Behavior

  1. Page is scrolling down

Environment

  • Angular: 17.0.8
  • CDK/Material: 17.0.4
  • Browser(s): Chrome 119.0.6045.160
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/tabs

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions