Skip to content
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

Svelte5: event.currentTarget always equals event.target #11328

Closed
JetLua opened this issue Apr 25, 2024 · 2 comments · Fixed by #11419
Closed

Svelte5: event.currentTarget always equals event.target #11328

JetLua opened this issue Apr 25, 2024 · 2 comments · Fixed by #11419
Milestone

Comments

@JetLua
Copy link

JetLua commented Apr 25, 2024

Describe the bug

<script>
	const state = $state({
		currentTarget: '',
		target: '',
	})
	function onclick(e) {
		state.currentTarget = e.currentTarget.id
		state.target = e.target.id
	}
</script>

<div role="button" tabindex="0" onkeydown={() => {}} id="parent" onclick={onclick} >
	Click parent
	<div id="child">Click child</div>
</div>

Reproduction

https://svelte-5-preview.vercel.app/#H4sIAAAAAAAAE31S0W7bMAz8FYIp1gTImq0Dhta1DQz9hb1Ne1AkpRHqUoJEZwkM_fsg2W6TotuLRR1Px9PJA-5sZyJWvwYk-WKwwh_e4xr55PMmHkzHBtcYXR9URuqogvXcChKsHEWGyJINNHBViuWQO4JVH4Ih_inDk-EKrq_XI86XQFrl764nxdYROFKdVc9Ls4JJp4jeXKhBA--QG6vP2fxG4_N-ElRv3vxTre0BgutMI3DbMzsSCCy3lrQ5NgK_CARHz-ak3R9qhuUKmhaGlMDqRqCX2UChFNPNMBUJSjqPuYaJRYLLtHJS7W2nBbYjo-zqjbaHNvsbV0G1b-fwhvNrpXrj29J-vIx4-CCqiSyojnzqTPG1GC3NAW9d0CZUcOuPoGXcGw0LKeXD2PVSa0tPFXz97o8Pr08bXajAO0tswoR-qvbuYMIsOwt_Vq7L5MXt_U59u5_IaXqOvORY3h36l5szP3evdj4Y_f_h0_j5fyjB4BpfnLY7azRWHHqTfqe_6cGPLh0DAAA=

Logs

No response

System Info

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Max
    Memory: 2.28 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.0.0 
    npm: 10.5.1 
    pnpm: 9.0.6 
  Browsers:
    Chrome: 124.0.6367.80
    Safari: 17.5
  npmPackages:
    svelte: 5.0.0-next.115 => 5.0.0-next.115

Severity

blocking an upgrade

@svelte-kit-so-good
Copy link

svelte-kit-so-good commented Apr 25, 2024

Nice demo 👍. Looks like it breaks starting in alpha 111 (working stackblitz with alpha 110).

@paoloricciuti
Copy link
Contributor

Possibly introduced by #11263 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants