-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
feat(keycodes): add utilities for checking modifier keys #13933
Conversation
67c1142
to
686af5b
Compare
@devversion I'm not too sure how the tests should be set up with Bazel since this isn't an |
686af5b
to
d177b56
Compare
@crisbeto Have a look in the |
d177b56
to
a4e5487
Compare
This one is definitely a |
@devversion by the looks of it, the |
a4e5487
to
b775035
Compare
@crisbeto Ah I didn't realize you wanted to run them in the browser. You should be able to use Just be aware that the one in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
5e4b368
to
98ad3ae
Compare
afc33bb
to
d87603a
Compare
Sorted out the test issues with help from @devversion. @jelbourn @devversion can you take another look? |
c1e35cc
to
b3d65f4
Compare
Based off of the conversation in angular#13790, these changes add some utilities for dealing with modifier keys on keyboard events.
b3d65f4
to
3e4ea4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
type ModifierKey = 'altKey' | 'shiftKey' | 'ctrlKey' | 'metaKey'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use an enum for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but I wanted to keep the consumption as short as possible. With the enum people would need another import and the call would look like hasModifierKeys(event, ModifierKey.altKey, ModifierKey.shiftKey)
which gets a little long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings also make sense here because they are the real properties on KeyboardEvent
Based off of the conversation in #13790, these changes add some utilities for dealing with modifier keys on keyboard events.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Based off of the conversation in #13790, these changes add some utilities for dealing with modifier keys on keyboard events.