Skip to content

withModifiers(() => {}, [" enter"]) Does not take effect in JSX #13139

Discussion options

You must be logged in to vote

The input event does not support the enter modifier, as enter is meant for keyboard events (e.g., keydown/keyup).

Workarounds: Playground

  1. ​Use withKeys (Vue's built-in helper):
const Foo = () => {
   return <input onKeyup={withKeys(test, ['enter'])} />;
};
  1. ​JSX directive syntax (via unplugin-vue-macros):
const Bar = () => {
  return <input onKeyup_enter={test} />;
};
  1. Manual key check in the handler

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@laamfun
Comment options

@jh-leong
Comment options

jh-leong Apr 2, 2025
Collaborator

Answer selected by laamfun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #13130 on April 02, 2025 03:02.