辅助功能¶
Hex 的窗口、听写 HUD 和胶囊会将其元素暴露给操作系统辅助功能 API:Windows 上的 UI Automation(Narrator、NVDA、Voice Access)、macOS 上的 NSAccessibility(VoiceOver、Voice Control)以及 Linux 上的 AT-SPI(Orca)。Rune 使用 AccessKit 根据每个元素已有的属性(角色、标签、文本、键、焦点)以及 Hex 添加的构建器(description、checked、disabled、a11y_value、live_region、position_in_set、a11y_hidden)构建语义树。strobe 在交互基准测试中驱动的也是这同一棵树。
在辅助客户端请求之前,不会构建任何内容,因此在此之前 Hex 无需为此付出任何代价。名称和描述与可见文本一样,都通过 desktop::i18n 进行本地化。
窗口¶
Settings window // a11y.window
├── Root -> the window, named by its title
├── Sidebar -> a list; each pane a list item named by its title // a11y.sidebar
│ ├── The pane that shows -> selected; the others unselected
│ ├── Labs and Playground -> list items too; Labs selected while its page shows
│ └── Select through accessibility (Invoke) -> the same switch as a click
├── Pane -> main; its title a level 1 heading, each card's label a level 2 heading
├── Setting rows // a11y.rows
│ ├── A row with a switch -> one switch: named by its title, described by
│ │ its note, checked or unchecked; Toggle flips it as a press does
│ ├── Held by policy or locked on -> the switch is disabled
│ ├── A row with a choice -> the choice is named by the row's title and
│ │ reads its current choice as its value (Speech model, Language,
│ │ Microphone, Vocabulary, Sounds, Shortcut mode, Keep meetings, …)
│ └── Icons, separators, status dots, level bars -> left out
├── History // a11y.history
│ ├── The list -> named History, its size the entries shown (at most 200)
│ ├── Each entry -> a list item named by its text, described by its kind,
│ │ app, and age; its place in the list; the open one selected
│ ├── Search -> a text field named "Search history"
│ └── Keep -> "History retention" with the retention as its value
├── Meetings -> the same list shape, named Meetings, day headings level 3
├── Speech model picker -> a modal dialog named by its title // a11y.picker
│ ├── The window behind it leaves the tree while it is open
│ ├── Compare -> one group per model column, named by the model
│ └── Every model -> lists per group, each model a list item with its place
└── Icon-only buttons -> named (Close, Copy, Delete, Remove, Back, More, …)
来源:controls.rs(copy_row_tagged、pressable_row、select_sized、value_button)、sidebar.rs、list_detail.rs、lists.rs、history.rs 和 picker.rs。
检查:accessibility_tests.rs 会为除 live 外的每个 --snap 场景读取 Runtime::accessibility_json:
every_control_in_every_scene_has_a_name(每个具有点击或焦点操作、或控件角色的元素都有非空名称)、
the_sidebar_says_which_pane_shows_and_switches_through_accessibility、
history_lists_its_entries_with_their_place、
settings_switches_say_whether_they_are_on、
choices_name_what_they_choose_and_read_their_value、
the_model_picker_is_a_named_modal_dialog,以及
the_pane_title_is_its_heading。
这些检查会在 CI 中的每个操作系统上运行。它们读取的是 Rune 将发送的树;并不证明屏幕阅读器实际会读出什么。
HUD 与胶囊¶
Dictation HUD (click-through overlay) // a11y.hud
├── A status, polite live region, described "Dictation"
├── Recording -> named "Recording"; Transcribing -> "Transcribing"; a failure -> "Failed"
│ └── The name changing is what screen readers announce
└── Hidden or fading -> no name; the overlay takes no input or focus
Meeting capsules // a11y.capsules
├── Each capsule -> a status named by its title; its subtitle readable inside
└── Buttons named by their text; "…" is named More, ✕ Close
Annotate capsule // macOS, Linux, Windows
└── Its icons named (Draw, Stop, Discard, Close); Draw checked while drawing
来源:IndicatorModel::status 位于 dictation/indicator.rs,view 位于 rune_hud.rs;meeting_capsules.rs;capture_capsule/mod.rs。检查:the_status_says_recording_then_transcribing(只测试模型)。胶囊和 HUD 的树没有测试。
自动化使用的键¶
strobe 的选择器是元素键,树会将这些键暴露为 UI Automation 的 AutomationId。请保持这些键稳定;perf/interaction.bench.ts 会使用它们:
nav-general、nav-history、nav-output、basics、output-content、history-list、history-scroll、history-search、transcription-control、transcription-picker、more-models、all-view、picker-back、compare-view、close-picker。
未验证¶
- 尚无真实屏幕阅读器会话:未观察到 Narrator、NVDA、VoiceOver 或 Orca 朗读窗口的情况。
- 尚无对正在运行的 Hex 的实时 UI Automation 读取:交互基准测试的首次运行需要已解锁的 Windows 会话。
- 会议胶囊、Annotate 胶囊和 HUD 没有树测试。
- 新用户引导故事和练习游戏仅由 every-control-has-a-name 检查覆盖,未经过阅读顺序审查。
本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 hex19/hex