Skip to content

Rerender blocks onclick trigger #15334

Closed as not planned
Closed as not planned
@olle-forsslof

Description

@olle-forsslof

Describe the bug

I have a button with both onclick and onmousedown. Inside it renders an svg that has an if statement which renders either a circle or a rect.

In the repl, if you check the console, you can se the onclick event only fires every other time. Though if you either remove the if statement or the onmousedown event the onclick fires as it should.

Patrick from the Svelte discord wrote:

It seems like the rerendering has something to do with it.
It might be something in line with this: #15319

Somehow the event is not dispatched if the event.target rerenders. You can see it working correctly when clicking the button in the white area.

Edit: If you add pointer-events: none to the elements inside the svg everything works as expected.

Reproduction

https://svelte.dev/playground/e80c01add66845a1a6f022d12dcd6bda?version=5.20.2

Logs

System Info

Tested on Chrome

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