Skip to content

Extra examples of migrating keyCode modifiers #1125

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

Merged
merged 1 commit into from
Jul 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/guide/migration/keycode-modifiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ Since [`KeyboardEvent.keyCode` has been deprecated](https://developer.mozilla.or

```html
<!-- Vue 3 Key Modifier on v-on -->
<input v-on:keyup.delete="confirmDelete" />
<input v-on:keyup.page-down="nextPage">

<!-- Matches both q and Q -->
<input v-on:keypress.q="quit">
```

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

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

The keys for some punctuation marks can just be included literally. e.g. For the `,` key:

```html
<input v-on:keypress.,="commaPress">
```

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.

[Migration build flags:](migration-build.html#compat-configuration)

- `CONFIG_KEY_CODES`
Expand Down