mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
fix(link)!: do not render p
for disabled link
Closes #1924 Svelte 5 will not compile if `div` is nested inside `p` element. Refactor Link to render an `a` instead of `p` when disabled.
This commit is contained in:
parent
a0d5028540
commit
8bffc17d65
4 changed files with 24 additions and 21 deletions
|
@ -1,6 +1,4 @@
|
|||
<script>
|
||||
/** @restProps {a | p} */
|
||||
|
||||
/**
|
||||
* Specify the size of the link
|
||||
* @type {"sm" | "lg"}
|
||||
|
@ -34,10 +32,15 @@
|
|||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<!-- svelte-ignore a11y-no-redundant-roles -->
|
||||
<!-- svelte-ignore a11y-interactive-supports-focus -->
|
||||
{#if disabled}
|
||||
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
||||
<p
|
||||
<a
|
||||
bind:this="{ref}"
|
||||
role="link"
|
||||
aria-disabled="true"
|
||||
class:bx--link="{true}"
|
||||
class:bx--link--disabled="{disabled}"
|
||||
class:bx--link--inline="{inline}"
|
||||
|
@ -56,7 +59,7 @@
|
|||
</slot>
|
||||
</div>
|
||||
{/if}
|
||||
</p>
|
||||
</a>
|
||||
{:else}
|
||||
<a
|
||||
bind:this="{ref}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue