Skip to content

Commit

Permalink
🌐 fix(theme-switcher): properly translate aria-label (#192)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Böttcher <tim.boettcher2@rwth-aachen.de>
Co-authored-by: welpo <welpo@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 4, 2023
1 parent ab38f84 commit 2eaee65
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion static/js/themeSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function switchTheme() {
// Initialize the theme switcher button.
themeSwitcher.addEventListener("click", switchTheme, false);
themeSwitcher.setAttribute("role", "button");
themeSwitcher.setAttribute("aria-label", "Toggle dark mode");
let togglePressed = currentTheme === "dark" ? "true" : "false";
themeSwitcher.setAttribute("aria-pressed", togglePressed);

Expand Down
2 changes: 1 addition & 1 deletion static/js/themeSwitcher.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion templates/partials/theme_switcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{%- set combined_mode_str = dark_str ~ "/" ~ light_str -%}
{%- set title_label = toggle_str | replace(from="$MODE", to=combined_mode_str) -%}
{%- set aria_label = 'Toggle ' ~ dark_str ~ ' mode' -%}
{%- set aria_label = toggle_str | replace(from="$MODE", to=dark_str) -%}

<div
title="{{ title_label }}"
Expand Down

0 comments on commit 2eaee65

Please sign in to comment.