Modify click events to prevent navigation. (#946)

Without preventDefault the link will navigate the page instead of opening the dropdown when the tabs are in the compact mode.
Because the parent element also toggles on click, there is an additional stopPropagation to not toggle twice which in a no-op.
This commit is contained in:
brunnerh 2021-12-28 21:59:26 +01:00 committed by GitHub
commit d5a6b5873b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -130,8 +130,8 @@
tabindex="-1" tabindex="-1"
class:bx--tabs-trigger-text="{true}" class:bx--tabs-trigger-text="{true}"
href="{triggerHref}" href="{triggerHref}"
on:click on:click|preventDefault
on:click="{() => { on:click|preventDefault|stopPropagation="{() => {
dropdownHidden = !dropdownHidden; dropdownHidden = !dropdownHidden;
}}" }}"
> >