-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Log a soft exception from accessibility event exceptions #37002
Conversation
Base commit: 1ac3dab |
Wanted to bump this one for review since it's still causing issues for a number of our users |
Hi @cortinico, @Titozzz, As explained in the summary by Abbondanzo this PR would solve/improve the issue on Android that crashes if does not find the tag. you also mentioned that findNodeHandle is deprecated/is going to be deprecated - based on that, do you think this PR can be merged in? I have not found much documentation about deprecating findNodeHandle, would you also be so kind to point me in the right direction for that? |
Hey @consuelo-sanna |
sure @cortinico, it was this one issue 22807 Then I've also seen that recently this one was also opened up on the same matter issue 37015 |
When we met in person, you mentioned that someone shared that this is the "intended behavior". Could you link that conversation? |
yes, I was referring to this comment by titozzz I definitely see titozzz's point of view, but being a feature used for accessibilities reasons I think it would make more sense to handle it more gracefully than crashing, which would also align with what happens on iOS |
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Syncing my fork reopened this PR, was going to start work on something else from main (converting some of those tests to Kotlin). Want me to close this PR since it's been imported on your end? |
@cortinico merged this pull request in 5323221. |
) Summary: This PR attempts to solve [this issue](facebook#33021) I created last year, where accessibility events can fire after a view has been unmounted, causing the entire application to crash. This newly added try/catch block is modeled and copies verbiage exactly from the Fabric implementation of accessibility events [here](https://github.com/facebook/react-native/blob/2d9c81780c2bb3c2c2dc8875147261c9a1843eb4/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEventMountItem.java#L30-L43) and [here](https://github.com/facebook/react-native/blob/2d9c81780c2bb3c2c2dc8875147261c9a1843eb4/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEventMountItem.java#L30-L43). ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [ANDROID] [FIXED] - Fixed an issue where calling `Accessibility.setAccessibilityFocus` on an unmounted component would crash Pull Request resolved: facebook#37002 Test Plan: 1. I reimplemented the crash demo from the Snack showcased in [this issue](facebook#33021). I created the branch [here](https://github.com/Abbondanzo/react-native/pull/1/files), although I may archive or delete this repo in the future so the link is not permanent 1. I disabled the new Fabric architecture. This crash only occurs in the old architecture 1. I pressed the button that would set accessibility focus on an unmounted component, and it logs a soft exception as seen in the screenshot below. I've also attached a screenshot from an identical soft exception that already gets logged by Fabric 1. In both cases, the app continues to function as expected |Example SoftException from this change|Example SoftException from Fabric (no changes to this code)| |-|-| |![image](https://user-images.githubusercontent.com/10366495/233423632-9eaa7c06-90a0-4e5c-ad65-5cc98ea52dc6.png)|![image](https://user-images.githubusercontent.com/10366495/233423233-f8f0bdb4-7f90-44f8-92aa-27992f60ccf3.png)| Reviewed By: cipolleschi Differential Revision: D49270491 Pulled By: cortinico fbshipit-source-id: a489f160be44d78afb751527f70aa88e8a463ee0
Has this been released yet? I can't find the RN version needed for this fix. Any help appreciated. |
5323221 |
Summary:
This PR attempts to solve this issue I created last year, where accessibility events can fire after a view has been unmounted, causing the entire application to crash. This newly added try/catch block is modeled and copies verbiage exactly from the Fabric implementation of accessibility events here and here.
Changelog:
[ANDROID] [FIXED] - Fixed an issue where calling
Accessibility.setAccessibilityFocus
on an unmounted component would crashTest Plan: