Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme toggler is not accessible on mobile or via keyboard #49

Open
pepelsbey opened this issue Oct 5, 2022 · 0 comments
Open

Theme toggler is not accessible on mobile or via keyboard #49

pepelsbey opened this issue Oct 5, 2022 · 0 comments
Assignees
Labels
a11y bug Something isn't working

Comments

@pepelsbey
Copy link
Contributor

Unfortunately, it’s not possible to switch themes on mobile or use it via keyboard even on desktop.

It shows the list of options only when you hover #toggleTheme:

<li id="toggleTheme">Change Theme
  <ul>
    <li data-value="" class="selected">Auto</li>
    <li data-value="dark">Dark</li>
    <li data-value="light">Light</li>
  </ul>
</li>

To make it work better, markup should look like this:

<button type="button" aria-controls="theme-toggler" aria-expanded="false">
  Change Theme
</button>

<ul id="theme-toggler">
  <li>
    <button type="button" aria-pressed="false" value="auto">
      Auto
    </button>
  </li>
  <li>
    <button type="button" aria-pressed="true" value="dark">
      Dark
    </button>
  </li>
  <li>
    <button type="button" aria-pressed="false" value="light">
      Light
    </button>
  </li>
</ul>
  • When the “Change Menu” button is pressed, aria-expanded should switch to true
  • Once the menu is closed the button should go to false again
  • When one of the options is pressed, aria-pressed should switch to true
  • The rest options should switch to false

There’s a good article on web.dev

@torgo torgo added bug Something isn't working a11y labels Oct 10, 2022
@queengooborg queengooborg self-assigned this Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants