mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
refactor(a11y): update LinkButton for disabled state
This commit is contained in:
@@ -4,19 +4,20 @@ export interface Props {
|
|||||||
className?: string;
|
className?: string;
|
||||||
ariaLabel?: string;
|
ariaLabel?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
tabindex?: string;
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { href, className, ariaLabel, title, tabindex } = Astro.props;
|
const { href, className, ariaLabel, title, disabled = false } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<a
|
<a
|
||||||
type="button"
|
type="button"
|
||||||
href={href}
|
href={disabled ? "#" : href}
|
||||||
tabindex={tabindex}
|
tabindex={disabled ? "-1" : "0"}
|
||||||
class={`group ${className}`}
|
class={`group ${className}`}
|
||||||
aria-label={ariaLabel}
|
aria-label={ariaLabel}
|
||||||
title={title}
|
title={title}
|
||||||
|
aria-disabled={disabled}
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user