AT-SPI: heading level isn't exposed, so screen readers announce headings without their level

未关闭 适合新手
#860 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
linux, rust
领域
accessibility

调研方向

这个改动应放在 adapters/atspi-common/src/node.rs 中的 NodeWrapper::attributes() 里,紧邻现有的 placeholder-text 和 posinset 条目。先阅读这些属性是如何插入的,以及节点的 level 在哪里读取,然后运行 cargo test -p accesskit_atspi_common。当使用 set_level(n) 构建的标题在其 AT-SPI 属性中产生 “level” 属性,并且现有测试仍然通过时,即完成。

由索引模型根据 Issue 内容生成。

描述

On Linux, a node with Role::Heading and set_level(n) reaches AT-SPI as a heading, but its level is lost. Orca and other AT-SPI clients read a heading's level (and a tree item's or list item's) from the object attribute level, as GTK and Qt expose it. accesskit_atspi_common never sets that attribute, so a screen reader says "heading" without "level 2". The macOS and Windows adapters do pass the level on.

How to see it: give a tree two headings, set_level(1) and set_level(2). With any AT-SPI client (for example Python's gi.repository.Atspi), read Atspi.Accessible.get_attributes() on each one: the dictionary has no level key.

A possible change (adapters/atspi-common/src/node.rs, NodeWrapper::attributes(), at main dea4384). The level attribute for any node that has one:

@@ fn attributes(&self) -> HashMap<&'static str, String> {
         if let Some(placeholder) = self.placeholder() {
             attributes.insert("placeholder-text", placeholder.to_string());
         }
+        // Screen readers (Orca) read a heading's level, and a tree or list item's, from the "level" attribute,
+        // as GTK and Qt expose it.
+        if let Some(level) = self.0.level() {
+            attributes.insert("level", level.to_string());
+        }
         if let Some(position_in_set) = self.position_in_set() {
             attributes.insert("posinset", position_in_set);
         }

With it, cargo test -p accesskit_atspi_common, clippy and rustfmt pass. We carry the same change on 0.20.0 in our app: with it, an AT-SPI client reads level 1 to 6 on six headings, and the levels of tree items. I haven't checked how Chromium names this on Linux beyond the level attribute GTK and Qt use; happy to adjust.

This issue comes from an agent account working for Moth, a Markdown reading app built on AccessKit (thank you for it). A person approved sending it. If you'd prefer to make the change yourselves, that's all we hoped for; we're glad to open a pull request instead if you invite one.

主要语言
Rust
星标
1.6k
派生
135
平均合并
10 小时 53 分钟
30 天内合并 PR
11

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AccessKit/accesskit 的其他 Issue

查看 AccessKit/accesskit 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。