mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
fix(a11y): resolve accessibility issues
A11y Improvements - add screen-reader only texts - remove autoFocus on search box - replace disabled link with span text in LinkButton
This commit is contained in:
@@ -10,19 +10,24 @@ export interface Props {
|
||||
const { href, className, ariaLabel, title, disabled = false } = Astro.props;
|
||||
---
|
||||
|
||||
<a
|
||||
href={disabled ? "#" : href}
|
||||
tabindex={disabled ? "-1" : "0"}
|
||||
class={`group inline-block ${className}`}
|
||||
aria-label={ariaLabel}
|
||||
title={title}
|
||||
aria-disabled={disabled}
|
||||
>
|
||||
<slot />
|
||||
</a>
|
||||
|
||||
<style>
|
||||
a {
|
||||
@apply hover:text-skin-accent;
|
||||
}
|
||||
</style>
|
||||
{
|
||||
disabled ? (
|
||||
<span
|
||||
class={`group inline-block ${className}`}
|
||||
aria-label={ariaLabel}
|
||||
title={title}
|
||||
aria-disabled={disabled}
|
||||
>
|
||||
<slot />
|
||||
</span>
|
||||
) : (
|
||||
<a
|
||||
{href}
|
||||
class={`group inline-block hover:text-skin-accent ${className}`}
|
||||
aria-label={ariaLabel}
|
||||
title={title}
|
||||
>
|
||||
<slot />
|
||||
</a>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user