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

fix(expansion-panel): don't handle enter/space if modifier is pressed #13790

Merged

Conversation

crisbeto
Copy link
Member

Doesn't preventDefault and handle the enter and space key presses if the user is pressing any of the modifier keys.

Fixes #13783.

Doesn't `preventDefault` and handle the enter and space key presses if the user is pressing any of the modifier keys.

Fixes angular#13783.
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Oct 24, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 24, 2018
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -140,8 +140,11 @@ export class MatExpansionPanelHeader implements OnDestroy, FocusableOption {
// Toggle for space and enter keys.
case SPACE:
case ENTER:
event.preventDefault();
this._toggle();
if (!event.altKey && !event.metaKey && !event.shiftKey && !event.ctrlKey) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this PR, but we should think about adding some helper functions to cdk/keycodes for checking stuff like this

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Oct 24, 2018
@mmalerba mmalerba merged commit 04716b1 into angular:master Oct 25, 2018
crisbeto added a commit to crisbeto/material2 that referenced this pull request Oct 26, 2018
Along the same lines as angular#13790. Doesn't handle the prevent the default action for ENTER and SPACE when one of the modifier keys is pressed, in order to avoid interefering with the native keyboard shortcuts.
mmalerba pushed a commit that referenced this pull request Oct 26, 2018
…#13790)

Doesn't `preventDefault` and handle the enter and space key presses if the user is pressing any of the modifier keys.

Fixes #13783.
jelbourn pushed a commit that referenced this pull request Oct 29, 2018
…13827)

Along the same lines as #13790. Doesn't handle the prevent the default action for ENTER and SPACE when one of the modifier keys is pressed, in order to avoid interefering with the native keyboard shortcuts.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 1, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 1, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 1, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 1, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 2, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 3, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 3, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 3, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 3, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 3, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 3, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 3, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 3, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Nov 3, 2018
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
atscott pushed a commit to atscott/components that referenced this pull request Nov 5, 2018
…angular#13790)

Doesn't `preventDefault` and handle the enter and space key presses if the user is pressing any of the modifier keys.

Fixes angular#13783.
atscott pushed a commit to atscott/components that referenced this pull request Nov 5, 2018
…ngular#13827)

Along the same lines as angular#13790. Doesn't handle the prevent the default action for ENTER and SPACE when one of the modifier keys is pressed, in order to avoid interefering with the native keyboard shortcuts.
jelbourn pushed a commit that referenced this pull request Nov 6, 2018
…13827)

Along the same lines as #13790. Doesn't handle the prevent the default action for ENTER and SPACE when one of the modifier keys is pressed, in order to avoid interefering with the native keyboard shortcuts.
vivian-hu-zz pushed a commit that referenced this pull request Nov 6, 2018
Based off of the conversation in #13790, these changes add some utilities for dealing with modifier keys on keyboard events.
vivian-hu-zz pushed a commit that referenced this pull request Nov 7, 2018
Based off of the conversation in #13790, these changes add some utilities for dealing with modifier keys on keyboard events.
josephperrott pushed a commit that referenced this pull request Nov 20, 2018
Based off of the conversation in #13790, these changes add some utilities for dealing with modifier keys on keyboard events.
@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
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not toggle expansion panel on Enter or Space if Ctrl is pressed
5 participants