Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListKeyManager.onKeydown blocks navigation with Alt+Left #13496

Closed
jchv opened this issue Oct 8, 2018 · 1 comment · Fixed by #13503
Closed

ListKeyManager.onKeydown blocks navigation with Alt+Left #13496

jchv opened this issue Oct 8, 2018 · 1 comment · Fixed by #13503
Assignees
Labels
Accessibility This issue is related to accessibility (a11y) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@jchv
Copy link
Contributor

jchv commented Oct 8, 2018

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?

Stackblitz Demo

  1. Create a <mat-tab-group /> component.
  2. Focus a tab.
  3. 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.

@crisbeto crisbeto self-assigned this Oct 9, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Oct 9, 2018
* Skips handling arrow key events that have a modifier key. Previously we would prevent the default action which can get in the way of some of the native keyboard shortcuts (e.g. marking all of the text using shift + up arrow). This has come up before in angular#11987, however these changes expand it to the key manager.
* Adds an API that allows consumers to opt into having the key manager handle some modifier keys. This is an exception for some of our components where we have custom functionality for shift + arrow key.
* Fixes the `metaKey` always being set to true on our fake keyboard events.

Fixes angular#13496.
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent Accessibility This issue is related to accessibility (a11y) has pr labels Oct 9, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Oct 9, 2018
* Skips handling arrow key events that have a modifier key. Previously we would prevent the default action which can get in the way of some of the native keyboard shortcuts (e.g. marking all of the text using shift + up arrow). This has come up before in angular#11987, however these changes expand it to the key manager.
* Adds an API that allows consumers to opt into having the key manager handle some modifier keys. This is an exception for some of our components where we have custom functionality for shift + arrow key.
* Fixes the `metaKey` always being set to true on our fake keyboard events.

Fixes angular#13496.
crisbeto added a commit to crisbeto/material2 that referenced this issue Oct 9, 2018
* Skips handling arrow key events that have a modifier key. Previously we would prevent the default action which can get in the way of some of the native keyboard shortcuts (e.g. marking all of the text using shift + up arrow). This has come up before in angular#11987, however these changes expand it to the key manager.
* Adds an API that allows consumers to opt into having the key manager handle some modifier keys. This is an exception for some of our components where we have custom functionality for shift + arrow key.
* Fixes the `metaKey` always being set to true on our fake keyboard events.

Fixes angular#13496.
crisbeto added a commit to crisbeto/material2 that referenced this issue Nov 8, 2018
* Skips handling arrow key events that have a modifier key. Previously we would prevent the default action which can get in the way of some of the native keyboard shortcuts (e.g. marking all of the text using shift + up arrow). This has come up before in angular#11987, however these changes expand it to the key manager.
* Adds an API that allows consumers to opt into having the key manager handle some modifier keys. This is an exception for some of our components where we have custom functionality for shift + arrow key.
* Fixes the `metaKey` always being set to true on our fake keyboard events.

Fixes angular#13496.
vivian-hu-zz pushed a commit that referenced this issue Nov 8, 2018
…#13503)

* Skips handling arrow key events that have a modifier key. Previously we would prevent the default action which can get in the way of some of the native keyboard shortcuts (e.g. marking all of the text using shift + up arrow). This has come up before in #11987, however these changes expand it to the key manager.
* Adds an API that allows consumers to opt into having the key manager handle some modifier keys. This is an exception for some of our components where we have custom functionality for shift + arrow key.
* Fixes the `metaKey` always being set to true on our fake keyboard events.

Fixes #13496.
vivian-hu-zz pushed a commit that referenced this issue Nov 12, 2018
…#13503)

* Skips handling arrow key events that have a modifier key. Previously we would prevent the default action which can get in the way of some of the native keyboard shortcuts (e.g. marking all of the text using shift + up arrow). This has come up before in #11987, however these changes expand it to the key manager.
* Adds an API that allows consumers to opt into having the key manager handle some modifier keys. This is an exception for some of our components where we have custom functionality for shift + arrow key.
* Fixes the `metaKey` always being set to true on our fake keyboard events.

Fixes #13496.
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility This issue is related to accessibility (a11y) P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants