Skip to content

Commit afc2a95

Browse files
docs: extra examples of migrating keyCode modifiers (#1125)
1 parent d9430c2 commit afc2a95

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/guide/migration/keycode-modifiers.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ Since [`KeyboardEvent.keyCode` has been deprecated](https://developer.mozilla.or
4646

4747
```html
4848
<!-- Vue 3 Key Modifier on v-on -->
49-
<input v-on:keyup.delete="confirmDelete" />
49+
<input v-on:keyup.page-down="nextPage">
50+
51+
<!-- Matches both q and Q -->
52+
<input v-on:keypress.q="quit">
5053
```
5154

5255
As a result, this means that `config.keyCodes` is now also deprecated and will no longer be supported.
@@ -55,6 +58,14 @@ As a result, this means that `config.keyCodes` is now also deprecated and will n
5558

5659
For those using `keyCode` in their codebase, we recommend converting them to their kebab-cased named equivalents.
5760

61+
The keys for some punctuation marks can just be included literally. e.g. For the `,` key:
62+
63+
```html
64+
<input v-on:keypress.,="commaPress">
65+
```
66+
67+
Limitations of the syntax prevent certain characters from being matched, such as `"`, `'`, `/`, `=`, `>`, and `.`. For those characters you should check `event.key` inside the listener instead.
68+
5869
[Migration build flags:](migration-build.html#compat-configuration)
5970

6071
- `CONFIG_KEY_CODES`

0 commit comments

Comments
 (0)