mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +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}"
|
||||
{...$$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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue