vuejs / babel-plugin-jsx

JSX for Vue 3
https://vue-jsx-explorer.netlify.app
MIT License
1.7k stars 143 forks source link

Cannot register "capture" phase event handlers #714

Open davidAtInleague opened 1 month ago

davidAtInleague commented 1 month ago

🐛 Bug description

Event handlers using onXXX={withModifiers(..., ["capture"])} are not registered in "capture" mode.

📝 Steps to reproduce

Attempt to register an event handler using the readme's suggested syntax of withModifiers

Reproduction Link (required): https://stackblitz.com/edit/vitejs-vite-c3hwy2?file=src%2FApp.vue,index.html

🏞 Desired result

Event handlers can be registered in capture mode.

🚑 Other information

https://github.com/vuejs/babel-plugin-jsx/issues/533

davidAtInleague commented 1 month ago

onClickCapture works but there's not a declared type for it, so TSC kicks it out. This leaves us with the workaround

<div {...{onClickCapture: evt => {}}}>...</div>

Maybe types can be added for *Capture suffixed events?