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} className={styles.item}
disabled={disabled} disabled={disabled}
{...(href ? { href, target: '_blank' } : {})} {...(href ? { href, target: '_blank' } : {})}
aria-label={label}
> >
<span className={styles.label}> <span className={styles.label}>
<span className={styles.icon}>{icon}</span> {label} <span className={styles.icon}>{icon}</span> {label}

View File

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

View File

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