withModifiers(() => {}, [" enter"]) Does not take effect in JSX #13139
-
Vue version3.5.13 Link to minimal reproductionhttps://stackblitz.com/edit/vitejs-vite-qzas5vub?file=src%2Fmain.jsx Steps to reproduce![]() { What is expected?Trigger the function when the Enter key is pressed What is actually happening?Every time the button is pressed, the function will be triggered System InfoSystem:
OS: macOS 15.3.2
CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
Memory: 24.91 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - ~/.node/node-v22.12.0-darwin-x64/bin/node
Yarn: 1.22.22 - ~/.node/node-v22.12.0-darwin-x64/bin/yarn
npm: 10.9.0 - ~/.node/node-v22.12.0-darwin-x64/bin/npm
pnpm: 10.7.0 - ~/.node/node-v22.12.0-darwin-x64/bin/pnpm
Browsers:
Chrome: 134.0.6998.166
Safari: 18.3.1 Any additional comments?No response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The Workarounds: Playground
const Foo = () => {
return <input onKeyup={withKeys(test, ['enter'])} />;
};
const Bar = () => {
return <input onKeyup_enter={test} />;
};
|
Beta Was this translation helpful? Give feedback.
The
input
event does not support theenter
modifier, asenter
is meant for keyboard events (e.g.,keydown
/keyup
).Workarounds: Playground
withKeys
(Vue's built-in helper):