Skip to content

a11y: Applying routerLink directive to mat-button-toggle breaks keyboard tab navigation #51384

@bjmc

Description

@bjmc

Which @angular/* package(s) are the source of the bug?

router

Is this a regression?

No

Reproduction info

Instructions

  • Load the application on a computer with a keyboard
  • Press the TAB key repeatedly to advance selection from start->off->on->end
  • Hold the SHIFT key and press TAB repeatedly to move through the elements in reverse order

Expected and Actual behavior.

Expected: shift+tab will allow moving backwards from End->On->Off->Start
Actual: Selection gets "stuck" at the "on" button

There seem to be duplicate tab stops set on the same element (note numbers 0, 2, 4 – 1 and 3 are obscured) screenshot from TabA11y

Screenshot from 2023-08-16 14-09-32

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-1nlukm?file=src%2Fmain.ts

Please provide the exception or error you saw

Shift+tab navigation gets "stuck" on the first mat-button-toggle element encountered.

Removing the routerLink directive restores navigation.

Please provide the environment you discovered this bug in (run ng version)

{
  "name": "stackblitz-starters-1nlukm",
  "version": "0.0.0",
  "private": true,
  "dependencies": {
    "@angular/animations": "^16.2.0",
    "@angular/cdk": "16.2.0",
    "@angular/common": "^16.2.0",
    "@angular/compiler": "^16.2.0",
    "@angular/core": "^16.2.0",
    "@angular/forms": "^16.2.0",
    "@angular/material": "^16.2.0",
    "@angular/platform-browser": "^16.2.0",
    "@angular/platform-browser-dynamic": "^16.2.0",
    "@angular/router": "^16.2.0",
    "@types/jasmine": "^4.3.5",
    "rxjs": "^7.8.1",
    "tslib": "^2.6.1",
    "zone.js": "^0.13.1"
  },
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1100.4",
    "@angular/cli": "~11.0.4",
    "@angular/compiler-cli": "~11.0.4",
    "@types/jasmine": "~3.6.0",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.1.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.2"
  }
}

Anything else?

Possibly related to #28345

Metadata

Metadata

Assignees

No one assigned

    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