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

Fix accessible prop for Image #2327

Merged
merged 13 commits into from
Jan 13, 2025
Merged

Conversation

ksiler
Copy link

@ksiler ksiler commented Jan 7, 2025

Summary:

Problem: Setting the accessible prop to false on RN Image does not remove the image from the accessibility tree on macOS. This is because the accessible prop is mapped to the accessibilityElement property but is set on NSImageView which has no effect. Instead, the accessibilityElement prop should be set on NSImageCell.

Solution: Add a way to retrieve NSImageCell from NSImageView and map RN's accessible prop to the accessibilityElement property on it.

Test Plan:

Added a toggle to the 'Accessibility' test example in ImageExamples.js to test the value of the accessible prop. Hovered over the image with Accessibility Inspector and verified that the image is not found when accessible is false. Also verified by turning on VoiceOver and confirmed the image did not get read when the accessible prop is false.

accessible prop is true:
Screenshot 2025-01-07 at 11 19 22 AM

accessible prop is false:
Screenshot 2025-01-07 at 11 20 29 AM

@ksiler ksiler requested a review from a team as a code owner January 7, 2025 18:08
@ksiler ksiler merged commit 14f6ccc into microsoft:main Jan 13, 2025
14 checks passed
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