-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Svelte 5: onkeydown event triggers more often than it should #10271
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
Comments
Analysis: Happens when adding the same event listener multiple times to the same the event, because |
…eners If you had `on:` directives listening to the same name (through multiple on:click on the same element or indirectly through multiple `<svelte:window>` elements with event listeners of the same name) there was a bug of delegation firing too often. This PR fixes that by tweaking the "should I continue with the given path index" logic. fixes #10271
…eners (#10307) If you had `on:` directives listening to the same name (through multiple on:click on the same element or indirectly through multiple `<svelte:window>` elements with event listeners of the same name) there was a bug of delegation firing too often. This PR fixes that by tweaking the "should I continue with the given path index" logic. fixes #10271
…eners (#10307) If you had `on:` directives listening to the same name (through multiple on:click on the same element or indirectly through multiple `<svelte:window>` elements with event listeners of the same name) there was a bug of delegation firing too often. This PR fixes that by tweaking the "should I continue with the given path index" logic. fixes #10271
Is the fix included in v5.0.0-next.50 already? So far, the behavior is still the same. @dummdidumm Are you seeing this? |
fixes #10271 The prior fix in #10307 wasn't quite right, because JSDom has a difference between window and event.composedPath which sounds like a bug, and a workaround in that PR made it so the test did pass when the bug still occurred. That's also why there isn't a test here, because we can't properly test this using JSDom.
Describe the bug
<svelte:window />
seems to produce some odd behavior in components. See reproduction.I'm pretty sure I didn't have this issue in Svelte 5 version 34. It started with 35.
(Link to Discord thread)
Reproduction
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAA62QQWuDQBCF_8oyFxMQvVsjlEJpDz3n0O1BdEyXuDPLOsYG8b-XVWhq00MoPe7sN--9eSM0psUOstcRqLQIGdw7BzHI2YVHd8JWEGLouPdVmORd5Y2TQpMWYx17UY_s7QNbx4QkqvFsVZSkq2myCEV3msJi01Mlhkm9l1S3uDdU87DZqjF8aqmYOm4xafmwiZ4CYuigXkpDakGjbRCSSVOeXvJQvrhkwwwppiOeax5oN373mVRaaMrXqdMCYrBcm8ZgDZn4Hqf4q5MVe2s7fzrykujnpVeCz-R6uV1vxv-hOE25CVIqlLDTIPghGq53Zr_pl1rfpk8h3uptdgIAAA==
When you enter a character into the input field I expect three keyboard events to be triggered:
However, Component Input is triggered twice, so there are four events in total.
Logs
System Info
System: OS: Linux 6.7 Arch Linux CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz Memory: 4.95 GB / 7.64 GB Container: Yes Shell: 5.9 - /usr/bin/zsh Binaries: Node: 21.6.0 - /usr/bin/node Yarn: 1.22.21 - /usr/bin/yarn npm: 10.3.0 - /usr/bin/npm pnpm: 8.14.0 - /usr/bin/pnpm Browsers: Chromium: 121.0.6167.71 npmPackages: svelte: 5.0.0-next.37 => 5.0.0-next.37
Severity
blocking all usage of svelte
The text was updated successfully, but these errors were encountered: