feat: add better aria labels

This commit is contained in:
MAZE 2024-04-24 16:04:18 +03:30
parent 9774532308
commit 98e5021f56
3 changed files with 5 additions and 3 deletions

View File

@ -29,6 +29,7 @@ export function Item({
className={styles.item}
disabled={disabled}
{...(href ? { href, target: '_blank' } : {})}
aria-label={label}
>
<span className={styles.label}>
<span className={styles.icon}>{icon}</span> {label}

View File

@ -4,16 +4,17 @@ import styles from './range.module.css';
interface RangeProps {
id: string;
label: string;
}
export function Range({ id }: RangeProps) {
export function Range({ id, label }: RangeProps) {
const setVolume = useSoundStore(state => state.setVolume);
const volume = useSoundStore(state => state.sounds[id].volume);
const isSelected = useSoundStore(state => state.sounds[id].isSelected);
return (
<input
aria-labelledby={id}
aria-label={`${label} sound volume`}
autoComplete="off"
className={styles.range}
disabled={!isSelected}

View File

@ -105,7 +105,7 @@ export function Sound({
<div className={styles.label} id={id}>
{label}
</div>
<Range id={id} />
<Range id={id} label={label} />
</div>
);
}