fix(a11y): add Accessible roles and localize remaining hardcoded QML labels#182
Open
hughesyadaddy wants to merge 1 commit into
Open
Conversation
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.
b9c2159 to
3f1b028
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 + MouseArearather thanButton, so screen readers previously announced them as nameless rectangles. Add:Accessible.role: Accessible.ButtonAccessible.namebound to the visible localized textAccessible.checkable: true+Accessible.checkedmirroring the active stateAccessible.onPressActionthat calls the same setter theMouseAreaalready invokes (so keyboard / AT activation works without duplicating logic)The About dialog close
Rectanglefollows the same pattern.SmartShift toggle label localized
smartShiftToggle.Accessible.namewas the literal string"SmartShift". Bind it tos["scroll.smart_shift"]so VoiceOver / Narrator / Orca speak the localized name in zh_CN and zh_TW.Chinese trackpad strings filled in
scroll.ignore_trackpadandscroll.ignore_trackpad_deschad English strings in bothzh_CNandzh_TW. Translated to match the surrounding rows.Test plan
New
AccessibilityLocaleTestsintests/test_locale_manager.py:test_required_accessibility_keys_present_in_all_locales—dialog.close,scroll.ignore_trackpad,scroll.ignore_trackpad_desc,scroll.smart_shiftare 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.pytest tests/ -q— 497 passed, 1 skipped, 175 subtests passed.Notes
dialog.closekey added across all three locales for reuse by future dialog chrome.MouseAreapath, so sighted-mouse users see the same UI.