Skip to content

fix(a11y): add Accessible roles and localize remaining hardcoded QML labels#182

Open
hughesyadaddy wants to merge 1 commit into
TomBadash:masterfrom
hughesyadaddy:fix/qml-accessibility-and-localization
Open

fix(a11y): add Accessible roles and localize remaining hardcoded QML labels#182
hughesyadaddy wants to merge 1 commit into
TomBadash:masterfrom
hughesyadaddy:fix/qml-accessibility-and-localization

Conversation

@hughesyadaddy
Copy link
Copy Markdown
Contributor

@hughesyadaddy hughesyadaddy commented May 18, 2026

Summary

Three accessibility gaps on the Scroll page and the About dialog. None of them are visible to a sighted English user, which is why they slipped through previous reviews — but they each silently regress non-English locales or assistive technology.

Changes

Accessible roles on rectangle-based "buttons"

The SmartShift mode picker (Ratchet / Free-spin) and the language selector are Rectangle + MouseArea rather than Button, so screen readers previously announced them as nameless rectangles. Add:

  • Accessible.role: Accessible.Button
  • Accessible.name bound to the visible localized text
  • Accessible.checkable: true + Accessible.checked mirroring the active state
  • Accessible.onPressAction that calls the same setter the MouseArea already invokes (so keyboard / AT activation works without duplicating logic)

The About dialog close Rectangle follows the same pattern.

SmartShift toggle label localized

smartShiftToggle.Accessible.name was the literal string "SmartShift". Bind it to s["scroll.smart_shift"] so VoiceOver / Narrator / Orca speak the localized name in zh_CN and zh_TW.

Chinese trackpad strings filled in

scroll.ignore_trackpad and scroll.ignore_trackpad_desc had English strings in both zh_CN and zh_TW. Translated to match the surrounding rows.

Test plan

New AccessibilityLocaleTests in tests/test_locale_manager.py:

  • test_required_accessibility_keys_present_in_all_localesdialog.close, scroll.ignore_trackpad, scroll.ignore_trackpad_desc, scroll.smart_shift are present and non-empty in every locale.
  • test_chinese_locales_do_not_passthrough_english — pins that the two trackpad strings no longer ship the English fallback.
  • Full pytest tests/ -q — 497 passed, 1 skipped, 175 subtests passed.

Notes

  • New dialog.close key added across all three locales for reuse by future dialog chrome.
  • QML changes are additive — no behavioral change for the MouseArea path, so sighted-mouse users see the same UI.

Three accessibility gaps that screen readers and non-English locales
hit on the Scroll page and the About dialog. None of them are visible
to a sighted user using the default English locale, which is why they
slipped through previous reviews.

Accessibility roles on rectangle-based "buttons"
- The SmartShift mode picker (Ratchet / Free-spin) and the language
  selector are implemented as ``Rectangle + MouseArea`` rather than
  ``Button``, so they previously surfaced to assistive tech as plain
  rectangles with no name, no role, and no toggled state. Add
  ``Accessible.role: Accessible.Button``, ``Accessible.name`` from the
  visible text, ``Accessible.checkable: true``, an ``Accessible.checked``
  binding that mirrors the active state, and an ``Accessible.onPressAction``
  that calls the same setter the ``MouseArea`` already invokes.
- The About dialog close affordance is the same pattern (rectangle +
  close glyph + ``MouseArea``); add the same role / name /
  onPressAction so screen readers can announce and operate it.

SmartShift toggle label localized
- ``Switch.Accessible.name`` was hardcoded to the literal string
  ``"SmartShift"``. Bind it to ``s["scroll.smart_shift"]`` so VoiceOver,
  Narrator, and Orca read the localized name in zh_CN and zh_TW
  instead of an English word floating in a translated UI.

Chinese locales filled in
- ``scroll.ignore_trackpad`` and ``scroll.ignore_trackpad_desc`` had
  English strings in both the ``zh_CN`` and ``zh_TW`` translation
  tables. Translate them so the trackpad toggle row matches the rest
  of the Scroll page's localized copy.

Test plan
- New ``AccessibilityLocaleTests`` pins both invariants:
  ``test_required_accessibility_keys_present_in_all_locales`` asserts
  ``dialog.close``, ``scroll.ignore_trackpad``,
  ``scroll.ignore_trackpad_desc``, and ``scroll.smart_shift`` are
  present and non-empty in every locale.
  ``test_chinese_locales_do_not_passthrough_english`` pins that the
  trackpad strings are no longer the English fallback.
- Full pytest tests/ -q: 497 passed, 1 skipped, 175 subtests passed.
@hughesyadaddy hughesyadaddy force-pushed the fix/qml-accessibility-and-localization branch from b9c2159 to 3f1b028 Compare May 18, 2026 15:21
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