fix: make balance visibility toggle keyboard-accessible by GuTS805 · Pull Request #1412 · joinmarket-webui/jam · GitHub
Skip to content

fix: make balance visibility toggle keyboard-accessible - #1412

Merged
theborakompanioni merged 2 commits into
joinmarket-webui:develfrom
GuTS805:fix/balance-toggle-keyboard-accessibility
Aug 9, 2026
Merged

fix: make balance visibility toggle keyboard-accessible#1412
theborakompanioni merged 2 commits into
joinmarket-webui:develfrom
GuTS805:fix/balance-toggle-keyboard-accessibility

Conversation

@GuTS805

@GuTS805 GuTS805 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Convert the visibility toggle to a real element so it can be focused and activated via keyboard (Tab, Enter, Space), and add an aria-label/aria-pressed reflecting hidden/shown state for screen readers.

What does this PR do?

The balance hide/reveal toggle (used across wallet balances, send amounts, orderbook summaries, sweep schedules) was implemented as a plain <span onClick=...> with no keyboard support and no accessible semantics — keyboard-only and screen-reader users could not use it at all.

This PR:

  • Changes the clickable wrapper in ElementWithSymbols (Balance.tsx) to render a real <button type="button"> when interactive, instead of a bare <span> (falls back to <span> when the toggle is disabled, preserving existing non-interactive behavior).

  • Adds aria-label (reusing the existing settings.show_balance/settings.hide_balance i18n keys) and aria-pressed reflecting the current visibility state.

  • Native <button> semantics give keyboard focus and Enter/Space activation for free — no manual tabIndex/onKeyDown needed.

  • Adds 5 new tests covering accessible name, aria-pressed state changes, keyboard activation via Enter and Space, and confirming no button is rendered when the toggle is disabled.

  • Fixes Balance hide/reveal toggle is not keyboard-accessible or screen-reader-friendly #1409

Visual Demo (For contributors especially)

No visual change. The toggle looks and behaves identically for mouse users. The only difference is it's now also reachable and operable via keyboard (Tab to focus, Enter/Space to activate) and properly announced by screen readers.

Verified via automated tests: npx vitest run --project unit (808/808 relevant tests pass, including 5 new ones), tsc -b build clean, ESLint clean.

GuTS805 and others added 2 commits August 5, 2026 10:14
Convert the visibility toggle to a real <button> element so it can be
focused and activated via keyboard (Tab, Enter, Space), and add an
aria-label/aria-pressed reflecting hidden/shown state for screen readers.
@theborakompanioni
theborakompanioni merged commit 6022ed3 into joinmarket-webui:devel Aug 9, 2026
2 checks passed
@GuTS805
GuTS805 deleted the fix/balance-toggle-keyboard-accessibility branch August 9, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Balance hide/reveal toggle is not keyboard-accessible or screen-reader-friendly

2 participants