Skip to content

Svelte 5: on:click doesn't run (rare case, reproduction needed) #9938

@98mux

Description

@98mux

Describe the bug

I've haven't been able to successfully reproduce this in the repl or in a smaller project, it only happens in my main project. I'm mostly posting this here for visibility if anyone else experiences the same. Also I will post a successful reproduction once I've managed to figure it out. I'm pretty sure this is a Svelte 5 issue, as it only started happening when going from Svelte 4 -> Svelte 5

In my project, if I have a button inside a portal to body then that button is not clickable, it seems like the on:click doesn't get properly set, as it is never runned when clicking it. This gets resolved if I use svelte:element this="button" instead of a button (thought it only works for on:click and not onclick when using svelte:element)

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAA51V247TMBD9lVGElHRVpYLH0BYWKOKBm7TLE0HabDJtzTp2sJ2WquTfGdfObbsrLi9xEo_PzJk5Mz4Ga8ZRB8nXYyCyEoMkuKyqYBqYQ2U_9A65QfrWsla5_TPXuWKVAZ6JzSINjE6DZSpSw8pKKgOf6ZFxWCtZQhjP3GfsYMLnqZjP3Hl7Rsy9tcnUBg2h3cri4PHmt7UxUtjXlNacs_xucYwmsFjC0f1NTS6FlhxjLjdRuEWFT8PJ83ZzNrveMg0Cd6iA8DXkGedYABNQHqDMaK2U_I656Y-8qg0wA3up7rQ1NFsEhRV3Fk1j1-UJ15lYp1OgWEFIA_IMeT5zPE58iZXLRIIcSxSG4Jm2vB3XoGWb_CXdZyO68FYq0LK0EWdaiinUmokN3POpkEB2qE_cmNY1PpqRc75UvxHa0pbUlZFeSSilLNiaYREkRtXYTDtdOaO_kRbRNPjT6oHAao5jhR3BUG6g8RrrpWVtZhcXdoEL-KKzDSYwL9iO0oBJdXK_OIa51qAp-txIFTZLoJydGRUyry272AqyWTpID_yyylRWwvHd9Yf3K5eEBpA_vvtLG0VlaLzM4c2nD-C3rPPXV1dw5eNxIDO74M8T23UtcsNIVy60CPm0xVlAaMMLJ61AOP10eyvuZZHpg8h7kLoqMoORwP31yW7Sa6sD7TY7ZbE1RLZoct25XpBzRyscYLQoK044XQ5_1KgOLcPIWfSy9fDdOUIWNecjVOKxz6grbeGj4dH_c9j8m2-zVXJv0wIrpQjw5qOEtpfWshYFNY7Jt7bThtpKIA2eHB14kwY3D0ZglaOp_7owqBW1yURukz3Q0GNJNuNKebihbRf8NVXQERiSu_ki7oTct_pqC2zLncCTUR56jfg8wQsI7RpCAiN9DE81MVxyLvc0d62NTsDpBiIr_DZZE9sJA77xTY_RJ64Zi3XF46yqUBSvt4wX1Bq9JfJ4y4oCBeVonVFO_E6T-hula4kCKR55iAYZttUgAOpkiuSjLHCU_dFOrLCUOzwPoLnnz3feWIwKTa1ED-6Mpu2nD80jnc4092_Q_n0w-_44YeClrQWN0gfG1PkM6udKN3PObvL7E9TrHlwV3I2uOV2Rs9ONQeYPXhffmt9UA61UkggAAA==

Logs

No response

System Info

System:
    OS: Linux 5.18 Manjaro Linux
    CPU: (12) x64 AMD Ryzen 5 5600U with Radeon Graphics
    Memory: 556.61 MB / 7.08 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 21.1.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 10.2.3 - /usr/bin/npm
    bun: 0.8.1 - /usr/bin/bun
  Browsers:
    Chromium: 119.0.6045.123

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions