Skip to content

Teach ReactTextView Hit Testing/a11y about Facsimile State (Fixes hit testing/a11y for selectable Text in Facsimile)#55559

Open
NickGerleman wants to merge 2 commits intofacebook:mainfrom
NickGerleman:export-D93346617
Open

Teach ReactTextView Hit Testing/a11y about Facsimile State (Fixes hit testing/a11y for selectable Text in Facsimile)#55559
NickGerleman wants to merge 2 commits intofacebook:mainfrom
NickGerleman:export-D93346617

Conversation

@NickGerleman
Copy link
Contributor

Summary:
When enablePreparedTextLayout is true, we may reuse layouts (including backing Spannable), even when ShadowNode generation changes. React tags are subject to change during this period, so we have an extra layer of indirection, that users of PreparedLayout based state currently have to deal with.

This adds that logic so that hit testing, a11y delegate, and spans against FragmentIndex, all work in the scenario of ReactTextView with Facsimile state, used for selectable text.

Changelog: [Internal]

Differential Revision: D93346617

NickGerleman and others added 2 commits February 15, 2026 17:48
…cebook#55552)

Summary:
Pull Request resolved: facebook#55552

enablePreparedTextLayout replaces ReactTextView (a real TextView) with PreparedLayoutTextView (a ViewGroup that draws a pre-computed Layout). PreparedLayoutTextView does not support native text selection, so selectable text was broken when the flag was on (T222052152).

This diff adds support for selectable text by routing it through ReactTextView when enablePreparedTextLayout is enabled. A new JS component NativeSelectableText resolves to native name RCTSelectableText when the flag is on, or falls back to RCTText when it is off. Text.js uses NativeSelectableText whenever text is selectable, and a new SelectableTextViewManager (which extends ReactTextViewManager) is registered as RCTSelectableText in all ReactPackage sites.

ReactTextViewManager.updateState() is also updated to handle ReferenceStateWrapper holding PreparedLayout, so that it can process state delivered through the PreparedLayout path.

Note that this change relies on facebook/react#35780 to avoid warnings from React

Changelog: [Internal]

Differential Revision: D92928315

Reviewed By: mdvacca
… testing/a11y for selectable Text in Facsimile)

Summary:
When enablePreparedTextLayout is true, we may reuse layouts (including backing `Spannable`), even when ShadowNode generation changes. React tags are subject to change during this period, so we have an extra layer of indirection, that users of `PreparedLayout` based state currently have to deal with.

This adds that logic so that hit testing, a11y delegate, and spans against FragmentIndex, all work in the scenario of ReactTextView with Facsimile state, used for selectable text.

Changelog: [Internal]

Differential Revision: D93346617
@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 Feb 16, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 16, 2026

@NickGerleman has exported this pull request. If you are a Meta employee, you can view the originating Diff in D93346617.

@github-actions
Copy link

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

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. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants