Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AT-SPI2: Activate tree updates only if org.a11y.Status's IsEnabled is true #314

Closed
tronical opened this issue Nov 7, 2023 · 6 comments · Fixed by #324
Closed

AT-SPI2: Activate tree updates only if org.a11y.Status's IsEnabled is true #314

tronical opened this issue Nov 7, 2023 · 6 comments · Fixed by #324
Assignees

Comments

@tronical
Copy link

tronical commented Nov 7, 2023

In Slint we've had the situation that on Linux machines where there's no screen reader running, access kit would still send tree updates on the a11y bus. We've seen this in slint-ui/slint#3867 as well as in slint-ui/slint#3046 (comment) .

Based on my reading of https://www.freedesktop.org/wiki/Accessibility/AT-SPI2/ as well as peeking at the Qt Sources as well as Orca it seems like to me that AccessKit's AT-SPI2 adapter should consider itself active only if org.a11y.Status.IsEnabled in the path /org/a11y/bus on org.a11y.Bus on the session(!) bus is true, and of course watch the property for any changes.

Would this behaviour make sense to implement?

@mwcampbell
Copy link
Contributor

Do GTK and Qt check this status just once on startup, or can they connect to the bus, watch for the status to change, and initialize accessibility if, say, Orca is started after the application? The latter would be ideal, but we should at least aim for parity with existing toolkits.

@tronical
Copy link
Author

tronical commented Nov 7, 2023

Qt checks this once on startup and then is supposed to watch for changes, but that isn't implemented. I can't find out where Gtk would check for this property, but the spec suggests that this is what toolkits should do.

Okay, but your response sounds like you agree that access kit should implement the spec'ed behaviour. That would solve the issue one of our users reported (paying a price for tree updates despite no a11y tech being in use), while still providing full accessibility support when needed.

I might give it a try when I'm back - I'll be offline for a few weeks. But anyone please feel free to beat me to it ;-)

@DataTriny
Copy link
Member

Hello,
GTK3 may have used this property in the past, but GTK4 surely doesn't care.

By the way I have a VM running Ubuntu 23.10 on which the AT-SPI daemon is started and IsEnabled always return true even when no AT appear to be currently running. I think the bus launcher accepts an argument to force this property to true, and I wouldn't be surprised if some distributions use it if accessibility is configured to start with the system.

With that being said, this is on my TODO list. I didn't implement it initially because I wasn't sure where we would monitor for the property change signal, it's still a bit blur currently to be honest.

If we want to do it right, we should also monitor the session bus for name owner changed events for org.a11y.Bus, otherwise we risk crashing the application if the accessibility bus goes down. We also want this process to be centralized, keeping track of all the adapters so that we can activate/deactivate them from a single place.

I don't think it's going to be so easy, I can't really spend time on this before mid next week anyway.

@DataTriny
Copy link
Member

Woah, I overthought this one!

  • We don't need to watch for name owner changed signals if we directly monitor the session bus for property changes (without using the proxy mechanism provided by zbus).
  • As soon as the adapter is initialized, I think most UI toolkit developer don't mind if it doesn't deactivate when all ATs stop. Otherwise we would need to re-initialize an adapter and we will need a more complicated API for that.
  • At this point, Adapter::new should not return an Option anymore, The adapter's design should come closer to the subclassing adapters we have for macOS and Windows.
  • The hardest part is to initialize multiple adapters if an AT was not running when the app started.

I think I can handle this in a reasonably short time.

@DataTriny DataTriny self-assigned this Nov 19, 2023
@DataTriny
Copy link
Member

Status update

Tackling this issue is taking me way longer than I anticipated... I wasted time trying multiple approaches and I am not really used to writing async Rust, but I think I finally just solved the last major blocker. I still have a couple of tasks to finish, but the PR might be ready before this weekend.

@tronical
Copy link
Author

tronical commented Jan 4, 2024

Thank you for implementing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants