-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Update Key Modifiers to suggest KeyboardEvent.key #1850
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
Conversation
src/v2/guide/events.md
Outdated
|
||
<!-- also works for shorthand --> | ||
<input @keyup.enter="submit"> | ||
The usage of `keyCode` attributes is deprecated, but can be used if needed: |
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.
A better approach here IMHO would be using some p.tip
as a warning instead. Linking "deprecated" to the MDN article would also be nice.
Very nice :) Just a bit of change and this should be golden (for me at least). |
Co-Authored-By: kokopelli314 <nacclonts@Gmail.com>
Just made the updates, let me know if there's any other adjustments you'd recommend. |
Thanks! |
<!-- only call `vm.submit()` when the `keyCode` is 13 --> | ||
<input v-on:keyup.13="submit"> | ||
<!-- only call `vm.submit()` when the `key` is PageDown --> | ||
<input @keyup.page-down="onPageDown"> |
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.
Sorry for late, why here the key
becomes PageDown
not still Enter
? (The keyCode
of Enter
is 13
and the keyCode
of PageDown
is 34
. Ref: https://keycode.info, https://css-tricks.com/snippets/javascript/javascript-keycodes/)
I think it's better to remain the key Enter
is this case to match the meaning of "submit".
Thanks.
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.
That's a good point @Jinjiang, sorry I missed this. @kokopelli314 would you mind a subsequent PR?
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.
|
||
``` html | ||
<input @keyup.page-down="onPageDown"> | ||
``` |
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.
Fixes #1765.
I left the "define custom key modifier aliases" section at the bottom, below the deprecated key codes information. Definitely open to changing / re-arranging as needed!