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:
satnaing
2024-01-09 14:29:04 +06:30
committed by Sat Naing
parent de605d87a0
commit 940deb6d3f
6 changed files with 27 additions and 17 deletions
+21 -16
View File
@@ -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>
)
}