fix(web): announce current theme to screen reader users (#12039)

This commit is contained in:
Ben 2024-08-25 19:50:54 -04:00 committed by GitHub
parent b2dd5a3152
commit 96056208fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -7,8 +7,16 @@
$: icon = $colorTheme.value === Theme.LIGHT ? moonPath : sunPath;
$: viewBox = $colorTheme.value === Theme.LIGHT ? moonViewBox : sunViewBox;
$: isDark = $colorTheme.value === Theme.DARK;
</script>
{#if !$colorTheme.system}
<CircleIconButton title={$t('toggle_theme')} {icon} {viewBox} on:click={handleToggleTheme} />
<CircleIconButton
title={$t('toggle_theme')}
{icon}
{viewBox}
role="switch"
aria-checked={isDark ? 'true' : 'false'}
on:click={handleToggleTheme}
/>
{/if}