Skip to content

Commit dceefc6

Browse files
committed
call parent
1 parent b7264fe commit dceefc6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib/components/Accordion.svelte

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script>
22
import IconChevron from '$lib/icons/icon-chevron.svg?raw';
33
import { onMount } from 'svelte';
4+
import { createEventDispatcher } from 'svelte';
45
56
export let id = (Math.random() * 10e15).toString(16);
67
export let type = "checkbox"; // or "radio"
@@ -9,6 +10,8 @@
910
export let foregroundColor = null;
1011
export let backgroundColor = null;
1112
13+
const dispatch = createEventDispatcher();
14+
1215
let contentEl, inputEl;
1316
onMount(() => {
1417
contentEl.style.display = inputEl.checked ? 'block' : 'none';
@@ -27,6 +30,8 @@
2730
contentEl.style.maxHeight = '0px';
2831
});
2932
}
33+
// Dispatch click event so parent components can handle it (e.g., update URL hash)
34+
dispatch('click');
3035
}
3136
3237
function onTransitionEnd() {

0 commit comments

Comments
 (0)