Skip to content

Commit

Permalink
Accordion Item ID fix
Browse files Browse the repository at this point in the history
  • Loading branch information
endigo9740 committed Dec 3, 2023
1 parent 3801453 commit 295839f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* Provide a unique input id. Auto-generated by default
* @type {string}
*/
export let id = String(Math.random());
export let id = `accordion-control-${String(Math.random())}`;
// Classes
const cBase = '';
Expand Down Expand Up @@ -109,7 +109,7 @@
function onToggle(event?: SvelteEvent<MouseEvent, HTMLButtonElement>): void {
const currentOpenState = autocollapse ? $active === id : open;
/** @event {{ event: Event, id: string, open: boolean, autocollapse: boolean }} toggle - Fires when an accordion item is toggled. */
dispatch('toggle', { event, id: `accordion-control-${id}`, open: currentOpenState, autocollapse });
dispatch('toggle', { event, id, open: currentOpenState, autocollapse });
}
// If auto-collapse mode enabled and item is set open, set as this item active
Expand Down

0 comments on commit 295839f

Please sign in to comment.