fix: Fix problems related to the root node#231
Conversation
5e68ab5 to
b294b70
Compare
|
The scope of this PR expanded somewhat, based on feedback from a user who was trying to examine AccessKit nodes with Accessibility Inspector. |
|
@spencerudnick Can you please review this? |
|
I didn't try building and running anything yet, but in principle these changes look correct. It's nice to get hit-testing working! Let me know if you would like me to test things locally. |
|
Merging this now based on the feedback I already got from the user who raised the problems that this PR fixes. |
| let state = tree.state(); | ||
| let root = state.root(); | ||
| let point = from_ns_point(&view, &root, point); | ||
| if let Some(node) = root.node_at_point(point, &filter) { |
There was a problem hiding this comment.
hi @mwcampbell - I've arrived at this change from bevy, which relies on accesskit. this specific code change adds significant latency to bevy registering mouse click events on my Mac, running 13.5 (22G74).
bevy 0.11 upgraded accesskit in https://github.com/bevyengine/bevy/pull/8655/files which included this change. there is now a noticeable delay in mouse click events registering on my machine.
I've recorded a video to show what I mean, you can hear when my mouse clicks and when the event registers in bevy. on the left is the updated version of your code, and on the right is the previous version.
reverting this specific change in platforms/macos/src/adapter.rs fixes the latency.
I'm not familiar with this crate or code, but I'm guessing that get_or_create_platform_node(node.id()) with root is slow? can you help me understand why this was necessary? can you think of a reason why it might be adding latency?
in the meantime I'm going to open an issue in the Bevy repo at their request.
thanks in advance for any help
There was a problem hiding this comment.
logged the issue: bevyengine/bevy#9391
There was a problem hiding this comment.
You may need to post your video somewhere else, because on imgur, I don't hear anything.
Are you using any macOS accessibility features such as VoiceOver?
There was a problem hiding this comment.
Disregard my comment about Imgur; I found the volume control. But that video won't help me anyway. You said I could hear the difference, but apparently I need to be able to see as well in order to understand it. Anyway, I'll continue the discussion on the Bevy issue.
There was a problem hiding this comment.
oh are you blind? I'm sorry I didn't know that
basically it shows debug prints in the console happening much later than the audible mouse click
AccessKit allows the root node to omit the bounding rectangle. On Windows and Linux, we can use the window's own rectangle as a fallback. This PR implements the equivalent behavior on macOS.