fix(header-action): stop propagation on button click event (#1185)

This commit is contained in:
metonym 2022-03-19 10:44:05 -07:00 committed by GitHub
commit d9ee8cb2d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,16 +58,16 @@
class:action-text="{text}"
{...$$restProps}
on:click
on:click="{() => {
on:click|stopPropagation="{() => {
isOpen = !isOpen;
dispatch(isOpen ? 'open' : 'close');
}}"
>
<svelte:component this="{icon}" style="{isOpen ? 'display: none' : ''}" />
<svelte:component
this="{closeIcon}"
style="{!isOpen ? 'display: none' : ''}"
/>
{#if isOpen}
<svelte:component this="{closeIcon}" />
{:else}
<svelte:component this="{icon}" />
{/if}
<slot name="text">
{#if text}<span>{text}</span>{/if}
</slot>