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

JBR-8216 Implement setAccessibilityValue method for NavigableTextAccessibility #512

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

dmitrii-drobotov
Copy link
Member

  • This method allows for third-party tools to modify text component contents through the accessibility API on macOS;
  • In the legacy JavaTextAccessibility.m, there were methods accessibilityIsValueAttributeSettable and accessibilitySetValueAttribute, but in the current implementation we need to implement setAccessibilityValue and isAccessibilitySelectorAllowed;
  • The setAccessibilityValue method is implemented similarly to NavigableTextAccessibility.setAccessibilitySelectedText. On the Java side, it calls AccessibleEditableText.setTextContents according to the comment in JavaTextAccessibility.accessibilitySetValueAttribute;
  • The isAccessibilitySelectorAllowed method is implemented similarly to JavaTextAccessibility.accessibilityIsValueAttributeSettable: it checks if the text component implements AccessibleEditableText, is enabled, and additionally checks if the editable property is true, because some components could be enabled but not editable, and we shouldn't allow setting the value in this case.

Demo of this feature in Accessibility Inspector tool:

Screen.Recording.2025-02-07.at.11.13.29.mov

It's possible to edit value only for editable text components. Before this change, the button to edit the value was not even showing.

Copy link
Member

@OnePatchGuy OnePatchGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thank you for the patch! One thing worries me, everything else looks good.

…ssibility

* This method allows for third-party tools to modify text component contents through the accessibility API on macOS;
* The setAccessibilityValue method is implemented similarly to NavigableTextAccessibility.setAccessibilitySelectedText. On the Java side, it calls AccessibleEditableText.setTextContents according to the comment in JavaTextAccessibility.accessibilitySetValueAttribute;
* The isAccessibilitySelectorAllowed method is implemented similarly to JavaTextAccessibility.accessibilityIsValueAttributeSettable: it checks if the text component implements AccessibleEditableText, is enabled, and additionally checks if the editable property is true, because some components could be enabled but not editable, and we shouldn't allow setting the value in this case.
@OnePatchGuy OnePatchGuy merged commit 61a5013 into JetBrains:jbr21 Feb 13, 2025
@OnePatchGuy
Copy link
Member

The patch has been delivered to jbr21 and main branches.

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.

2 participants