-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Open
Description
Describe the bug
ontoggle should be fired after updating bind:open, not before. Quote from https://svelte.dev/docs/svelte/basic-markup#Events
Timing-wise, event attributes always fire after events from bindings (e.g. oninput always fires after an update to bind:value).
Reproduction
The following code can reproduce the problem in the Svelte playground
<script>
let bindingState = false;
let ontoggleState = false;
const ontoggle = () => {
ontoggleState = bindingState;
}
</script>
<details bind:open={bindingState} ontoggle={ontoggle} >
<div>Opened</div>
</details>
<p>
Reactive value: {bindingState}
</p>
<p>
Reactive value inside ontoggle: {ontoggleState}
</p>
Logs
System Info
svelte: 5.45.5Severity
annoyance
Metadata
Metadata
Assignees
Labels
No labels