Skip to content

Commit

Permalink
fix(web): announce current theme to screen reader users (#12039)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-basten authored Aug 25, 2024
1 parent b2dd5a3 commit 9605620
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion web/src/lib/components/shared-components/theme-button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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}
2 changes: 1 addition & 1 deletion web/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@
"to_login": "Login",
"to_trash": "Trash",
"toggle_settings": "Toggle settings",
"toggle_theme": "Toggle theme",
"toggle_theme": "Toggle dark theme",
"total_usage": "Total usage",
"trash": "Trash",
"trash_all": "Trash All",
Expand Down

0 comments on commit 9605620

Please sign in to comment.