Skip to content

Latest commit

 

History

History
37 lines (22 loc) · 1.02 KB

0014-drop-keycode-support.md

File metadata and controls

37 lines (22 loc) · 1.02 KB
  • Start Date: 2019-11-08
  • Target Major Version: 3.x
  • Reference Issues: N/A
  • Implementation PR: N/A

Summary

  • Drop support for using numbers (keyCodes) as v-on modifiers
  • Remove config.keyCodes

Basic example

N/A

Motivation

In Vue 2.x, v-on already supports using the kebab-case version of any valid KeyboardEvent.key as a modifier. For example, to trigger the handler only when event.key === 'PageDown':

<input @keyup.page-down="onArrowUp">

This makes number keyCodes and config.keyCodes redundant. In addition, KeyboardEvent.keyCode has been deprecated, so it would make sense for Vue to stop supporting it as well.

Drawbacks

N/A

Alternatives

N/A

Adoption strategy

  • A codemod can detect usage of number keyCode modifier usage and convert it to key equivalents.

  • In compat build, config.keyCode can be supported, and the runtime can emit warning when a keyCode alias is matched to allow easy migration.