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

Đang mở Phù hợp với người mới
#860 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
linux, rust
Lĩnh vực
accessibility

Hướng nghiên cứu

Thay đổi nằm trong NodeWrapper::attributes() tại adapters/atspi-common/src/node.rs, cạnh các mục placeholder-text và posinset hiện có. Hãy đọc cách các thuộc tính đó được thêm vào và nơi đọc cấp (level) của nút, sau đó chạy cargo test -p accesskit_atspi_common. Hoàn thành khi một tiêu đề được tạo bằng set_level(n) cho ra thuộc tính “level” trong các thuộc tính AT-SPI của nó và các kiểm thử hiện có vẫn pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
1.6k
Fork
135
Merge trung bình
10 giờ 53 phút
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AccessKit/accesskit

Tất cả issue của AccessKit/accesskit

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.