Skip to content

Commit 2898073

Browse files
committed
Add accessibility attributes for screen readers.
1 parent c8a2216 commit 2898073

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

apps/web/components/theme-toggle-icon.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ export const ThemeToggleIcon = () => {
66
const { theme } = useTheme();
77

88
return (
9-
<span className="view-transition-theme-icon">
9+
<button
10+
type="button"
11+
className="view-transition-theme-icon"
12+
aria-label={
13+
theme === "dark" ? "Switch to light theme" : "Switch to dark theme"
14+
}
15+
>
1016
{theme === "dark" ? (
1117
<Moon size={17} className="fill-white stroke-gray-3" />
1218
) : (
1319
<Sun size={17} className="stroke-gray-12" />
1420
)}
15-
</span>
21+
</button>
1622
);
1723
};

0 commit comments

Comments
 (0)