Skip to content

Svelte 5: onkeydown event triggers more often than it should #10271

@r-unruh

Description

@r-unruh

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:

  • Main Window
  • Component Window
  • Component Input

However, Component Input is triggered twice, so there are four events in total.

Logs

No errors

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions