Skip to content

Refactor focusability handling in ReactAxOrderHelper - #60379

Closed
PreetamPatidar wants to merge 1 commit into
react:mainfrom
PreetamPatidar:main
Closed

PreetamPatidar wants to merge 1 commit into
react:mainfrom
PreetamPatidar:main

Conversation

@PreetamPatidar

@PreetamPatidar PreetamPatidar commented Nov 28, 2026 •

Copy link
Copy Markdown

Summary:

Fixes an issue where changes to the accessible or focusable props on Text, Image, and ScrollView components are not preserved correctly when experimental_accessibilityOrder is active.

Currently, the accessibility order helper temporarily changes a view's focusability and stores its original value. If the component's accessible or focusable prop changes while the view is being held out of the accessibility order, the stored value can become stale. When the accessibility order is removed or the accessibility service state changes, the old value may be restored instead of the latest prop value.

This change ensures that focusability updates are preserved while accessibility-order handling is active, preventing stale values from being restored.

Changelog:

[ANDROID] [FIXED] - Preserve updated focusability values for Text, Image, and ScrollView components when experimental_accessibilityOrder is active.

Test Plan:

  • Verify that changing accessible from false to true while a view is held in the accessibility order preserves the updated value.
  • Verify that changing accessible from true to false works correctly.
  • Verify that changes to the focusable prop are preserved in both directions.
  • Verify that removing experimental_accessibilityOrder restores the latest focusability value.
  • Verify that existing accessibility behavior remains unchanged when no relevant props are updated.
  • Run the relevant Android tests.

@meta-cla

meta-cla Bot commented Nov 28, 2026

Copy link
Copy Markdown

Hi @PreetamPatidar!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@github-actions github-actions Bot added the Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. label Nov 28, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 28, 2026
@meta-cla

meta-cla Bot commented Nov 28, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 28, 2026
Comment on lines 84 to +97
if (view.getTag(R.id.original_focusability) == null) {
view.setTag(R.id.original_focusability, view.isFocusable)
}
view.isFocusable = false
}
val originalFocusability =
view.getTag(R.id.original_focusability)

if (originalFocusability != null) {
view.setTag(
R.id.original_focusability,
newFocusable
)
} else {
view.isFocusable = newFocusable
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you merge this with the branch above, and do the view.getTag(R.id.original_focusability) lookup once.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ok I will check

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the feedback! I've combined the conditions and reused the originalFocusability value to avoid performing the view.getTag() lookup twice. I'll update the implementation accordingly.

@javache

javache commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Please fix formatting and CI

@PreetamPatidar PreetamPatidar left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This Pull request is close please check on this #60412

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Meta Review Required This PR is considered risky and requires Meta to import it to do more testing before merging. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants