react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Rewrite accessibilityOrder with virtual view hierarchy

Open jorge-cab opened this issue 6 months ago • 1 comments

Summary: The original algorithm for accessibilityOrder on Android had unexpected bugs. For some reason .traversalAfter() and traversalBefore() have unexpected behaviors when dealing with ancestor/descendant relationships getting more and more unexpected the further apart they are.

So we are ditching that approach entirely.

Now we have the view with accessibilityOrder create a virtual view hierarchy. We create a virtual node for each child that is in the order, and set the virtual node's position to be the same as the View it is trying to represent.

We then also populate that node with the same stuff we populate regular ax nodes with the populateAccessibilityNodeInfo() function and the content description of the view it is backing so we get matching descriptions with what would otherwise be the normal announcement.

We have no way to exhaustively check every accessibility use case so we'll have to fine tune this as bugs come up, I'm expecting there to not be many issues since we populate the node the exact same way we populate every other node but anything that happens before React Native handles the node might miss some things

Differential Revision: D74766296

jorge-cab avatar May 29 '25 23:05 jorge-cab

This pull request was exported from Phabricator. Differential Revision: D74766296

facebook-github-bot avatar May 29 '25 23:05 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D74766296

facebook-github-bot avatar Jun 02 '25 21:06 facebook-github-bot

This pull request has been merged in facebook/react-native@997b7c99f65a5022de34da875b390feedb282fa5.

facebook-github-bot avatar Jun 04 '25 21:06 facebook-github-bot

This pull request was successfully merged by @jorge-cab in 997b7c99f65a5022de34da875b390feedb282fa5

When will my fix make it into a release? | How to file a pick request?

react-native-bot avatar Jun 04 '25 21:06 react-native-bot