-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
Bug, feature request, or proposal:
When using a component that uses ListKeyManager
under the hood, especially <mat-tab-header />
, the onKeydown
event handler swallows Alt+←, preventing the browser from going back. The same issue occurs with Alt+→, swallowing attempts to navigate forward, and it may possibly interfere with other events as well.
What is the expected behavior?
It should be possible to use keyboard shortcuts like Alt+← and Alt+→ when the tab bar is focused.
What is the current behavior?
Shortcuts like Alt+← and Alt+→ are treated as navigations within the component, calling event.preventDefault();
and thus interfering with the navigation attempt.
What are the steps to reproduce?
- Create a
<mat-tab-group />
component. - Focus a tab.
- Try navigating with Alt+←. This should fail.
What is the use-case or motivation for changing an existing behavior?
In some circumstances, the tab bar can become inadvertently focused without even clicking the tab bar, such as during a navigation event. This can interfere with a user's ability to navigate by keyboard, at least degrading the experience, requiring the user to blur the tab group before they are able to navigate.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
This issue does not impact a specific browser, OS, or TypeScript version.
Is there anything else we should know?
I can make a PR for fixing this, but exactly how to fix it should be agreed upon first. One potential solution would be to return early out of the onKeydown
handler when any modifier is being held.