-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A11Y: Add title attribute to theme switcher
This will add a `<title>` attribute to the SVG generated by font awesome, which will in turn update the Accessibility tree, which will now be - button "light/dark" focusable: true focused: bool - image: $title-text Should fix Quansight-Labs/czi-scientific-python-mgmt#76
- Loading branch information
Showing
4 changed files
with
21 additions
and
13 deletions.
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
src/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/theme-switcher.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{# Displays an icon to switch between light mode, dark mode, and auto (use browser's setting). #} | ||
{# As the theme switcher will only work when JavaScript is enabled, we hide it with `pst-js-only`. #} | ||
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button pst-js-only" title="{{ _('light/dark') }}" aria-label="{{ _('light/dark') }}" data-bs-placement="bottom" data-bs-toggle="tooltip"> | ||
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"></i> | ||
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"></i> | ||
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"></i> | ||
<button class="btn btn-sm nav-link pst-navbar-icon theme-switch-button pst-js-only" aria-label="{{ _('Color mode') }}" data-bs-title="{{ _('Color mode') }}" data-bs-placement="bottom" data-bs-toggle="tooltip"> | ||
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light" title="{{ _('Light') }}"></i> | ||
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark" title="{{ _('Dark') }}"></i> | ||
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto" title="{{ _('System Settings') }}"></i> | ||
</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<button aria-label="light/dark" class="btn btn-sm nav-link pst-navbar-icon theme-switch-button pst-js-only" data-bs-placement="bottom" data-bs-toggle="tooltip" title="light/dark"> | ||
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light"> | ||
<button aria-label="Color mode" class="btn btn-sm nav-link pst-navbar-icon theme-switch-button pst-js-only" data-bs-placement="bottom" data-bs-title="Color mode" data-bs-toggle="tooltip"> | ||
<i class="theme-switch fa-solid fa-sun fa-lg" data-mode="light" title="Light"> | ||
</i> | ||
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark"> | ||
<i class="theme-switch fa-solid fa-moon fa-lg" data-mode="dark" title="Dark"> | ||
</i> | ||
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto"> | ||
<i class="theme-switch fa-solid fa-circle-half-stroke fa-lg" data-mode="auto" title="System Settings"> | ||
</i> | ||
</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters