Skip to content

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

Open
xpoes123 wants to merge 1 commit into
qbreader:mainfrom
xpoes123:a11y/theme-dropdown-keyboard
Open

a11y: make theme-switcher dropdown keyboard-accessible#541
xpoes123 wants to merge 1 commit 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.

Convert href-less anchor dropdown items to buttons and add aria-haspopup to the toggle.
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.

1 participant