mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
fix(header-action): stop propagation on button click event (#1185)
This commit is contained in:
parent
233edf3358
commit
d9ee8cb2d9
1 changed files with 6 additions and 6 deletions
|
@ -58,16 +58,16 @@
|
||||||
class:action-text="{text}"
|
class:action-text="{text}"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
on:click
|
on:click
|
||||||
on:click="{() => {
|
on:click|stopPropagation="{() => {
|
||||||
isOpen = !isOpen;
|
isOpen = !isOpen;
|
||||||
dispatch(isOpen ? 'open' : 'close');
|
dispatch(isOpen ? 'open' : 'close');
|
||||||
}}"
|
}}"
|
||||||
>
|
>
|
||||||
<svelte:component this="{icon}" style="{isOpen ? 'display: none' : ''}" />
|
{#if isOpen}
|
||||||
<svelte:component
|
<svelte:component this="{closeIcon}" />
|
||||||
this="{closeIcon}"
|
{:else}
|
||||||
style="{!isOpen ? 'display: none' : ''}"
|
<svelte:component this="{icon}" />
|
||||||
/>
|
{/if}
|
||||||
<slot name="text">
|
<slot name="text">
|
||||||
{#if text}<span>{text}</span>{/if}
|
{#if text}<span>{text}</span>{/if}
|
||||||
</slot>
|
</slot>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue