Skip to content

Conversation

httnn
Copy link

@httnn httnn commented Sep 16, 2025

this wasn't previously implemented apparently because VoiceOver doesn't support it directly. however, there are other tools (like the Accessibility Inspector) that are able to set values so i think it's useful for at least building UI automations.

tested manually and confirmed to work!

fixes #612

@DataTriny
Copy link
Member

Thanks @httnn, this looks like a good start. You're absolutely right, we should try to not solely focus on what VoiceOver needs.

However I don't think this method is only used to set text value. Have you had a look at how Chromium handles it? If not, this might help you start browsing the code.

@httnn
Copy link
Author

httnn commented Sep 17, 2025

i though i saw somewhere in the Apple documentation that this method would only accept NSString, but i can't find it anymore. must have hallucinated it! the method indeed accepts any type of value. from what i've gathered, the method is only called with text and numbers in reality, so maybe i should just make it accept an NSObject again and add support for numbers too?

@DataTriny
Copy link
Member

from what i've gathered, the method is only called with text and numbers in reality

This was my conclusion too.

maybe i should just make it accept an NSObject again and add support for numbers too?

This would be appreciated, if you don't mind.

@httnn
Copy link
Author

httnn commented Sep 17, 2025

this should do it. required temporarily backporting downcast_ref from objc2 0.6: https://docs.rs/objc2/latest/objc2/runtime/struct.AnyObject.html#method.downcast_ref but other than that pretty straightforward.

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 this pull request may close these issues.

setAccessibilityValue on macOS
2 participants