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

Aperta Adatta ai principianti
#860 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
linux, rust
Ambito
accessibility

Direzione di ricerca

La modifica va in NodeWrapper::attributes() in adapters/atspi-common/src/node.rs, accanto alle voci esistenti placeholder-text e posinset. Leggi come vengono inseriti questi attributi e dove viene letto il livello del nodo, poi esegui cargo test -p accesskit_atspi_common. È completata quando un'intestazione creata con set_level(n) produce un attributo “level” nei suoi attributi AT-SPI e i test esistenti continuano a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Rust
Stelle
1.6k
Fork
135
Merge medio
10h 53m
PR unite (30g)
11

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AccessKit/accesskit

Tutte le issue di AccessKit/accesskit

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.