|
31 | 31 | aria-selected={active ? 'true' : 'false'}
|
32 | 32 | tabindex={active || forceAccessible ? '0' : '-1'}
|
33 | 33 | {href}
|
34 |
| - on:click={() => instance && instance.handleClick()} |
| 34 | + on:click={handleClick} |
35 | 35 | {...internalAttrs}
|
36 | 36 | {...exclude($$restProps, ['content$', 'tabIndicator$'])}
|
37 | 37 | >
|
|
66 | 66 | </svelte:component>
|
67 | 67 |
|
68 | 68 | <script lang="ts">
|
69 |
| - import type { TabIndicatorComponentDev } from '@smui/tab-indicator'; |
70 | 69 | import { MDCTabFoundation } from '@material/tab';
|
71 | 70 | import { onMount, setContext, getContext } from 'svelte';
|
72 |
| - import { get_current_component, SvelteComponentDev } from 'svelte/internal'; |
| 71 | + import type { SvelteComponentDev } from 'svelte/internal'; |
| 72 | + import { get_current_component } from 'svelte/internal'; |
| 73 | + import type { ActionArray } from '@smui/common/internal'; |
73 | 74 | import {
|
74 | 75 | forwardEventsBuilder,
|
75 | 76 | classMap,
|
76 | 77 | exclude,
|
77 | 78 | prefixFilter,
|
78 | 79 | useActions,
|
79 | 80 | dispatch,
|
80 |
| - ActionArray, |
81 | 81 | } from '@smui/common/internal';
|
82 | 82 | import Ripple from '@smui/ripple';
|
83 | 83 | import { A, Button } from '@smui/common/elements';
|
| 84 | + import type { TabIndicatorComponentDev } from '@smui/tab-indicator'; |
84 | 85 | import TabIndicator from '@smui/tab-indicator';
|
85 | 86 |
|
86 |
| - import type { SMUITabAccessor } from './Tab.types.js'; |
| 87 | + import type { SMUITabAccessor } from './Tab.types'; |
87 | 88 |
|
88 | 89 | const forwardEvents = forwardEventsBuilder(get_current_component());
|
89 | 90 |
|
|
181 | 182 | };
|
182 | 183 | });
|
183 | 184 |
|
| 185 | + function handleClick(event: PointerEvent) { |
| 186 | + if (!event.defaultPrevented) { |
| 187 | + instance?.handleClick(); |
| 188 | + } |
| 189 | + } |
| 190 | +
|
184 | 191 | function hasClass(className: string) {
|
185 | 192 | return className in internalClasses
|
186 | 193 | ? internalClasses[className]
|
|
0 commit comments