Skip to content

a11y: make theme-switcher dropdown keyboard-accessible#541

Merged
geoffrey-wu merged 4 commits into
qbreader:mainfrom
xpoes123:a11y/theme-dropdown-keyboard
Jul 4, 2026
Merged

a11y: make theme-switcher dropdown keyboard-accessible#541
geoffrey-wu merged 4 commits into
qbreader:mainfrom
xpoes123:a11y/theme-dropdown-keyboard

Conversation

@xpoes123

@xpoes123 xpoes123 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

The theme-switcher dropdown items in client/ssi/nav.html were bare <a> elements with no href, making them unreachable by keyboard navigation. This converts them to native buttons and correctly advertises the popup role to assistive technologies.

Problem

In client/ssi/nav.html, the Light / Night / Auto theme options were <a class="dropdown-item ..."> elements with no href. Without an href, anchor elements are not in the tab order and cannot be activated with Enter or Space. Users navigating by keyboard or using assistive technologies could not change the site theme.

Additionally, the #bd-theme toggle button was missing aria-haspopup, so screen readers received no indication that activating it opens a menu.

Changes

  • Converts the three theme-option <a> elements to <button type="button" class="dropdown-item ...">, which are natively focusable and keyboard-operable.
  • Adds aria-haspopup="menu" to the #bd-theme toggle button.

Risk & testing

Bootstrap's querySelectorAll('[data-bs-theme-value]') selector and plain click listeners in the theme-switching script work identically on buttons and anchors, so there is no functional change. Visual appearance is unchanged — Bootstrap's dropdown-item styles apply equally to <button> elements. Only client/ssi/nav.html is modified.

xpoes123 and others added 4 commits June 29, 2026 23:43
Convert href-less anchor dropdown items to buttons and add aria-haspopup to the toggle.
* ux: add navigation links to the 404 page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* ux: add navigation links to the 404 page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix SSI for 404 page

* fix status code

* fix page appearance

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Geoffrey Wu <geoffreywu1000@gmail.com>
Convert href-less anchor dropdown items to buttons and add aria-haspopup to the toggle.
@geoffrey-wu geoffrey-wu merged commit 71e28c2 into qbreader:main Jul 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants