Skip to content

Fix viewability reporting for cross-orientation nested lists (#58412) - #58412

Open
amroaltah wants to merge 1 commit into
react:mainfrom
amroaltah:export-D117727511
Open

Fix viewability reporting for cross-orientation nested lists (#58412)#58412
amroaltah wants to merge 1 commit into
react:mainfrom
amroaltah:export-D117727511

Conversation

@amroaltah

@amroaltah amroaltah commented Sep 8, 2026

Copy link
Copy Markdown

Summary:

A horizontal VirtualizedList nested inside a vertical list could report its items through onViewableItemsChanged while the parent row was off screen. The existing same-orientation nesting path translates parent scroll metrics, but cross-orientation children have independent scroll axes and therefore need the visibility of their containing row as a separate signal.

Expose a semantic cell-visibility query through VirtualizedListContext and register cross-orientation children with the key of their containing cell. Parents evaluate those cells after scroll and layout changes, but invoke children only when the ancestor suppression state transitions. Known data rows without layout metrics fail closed, eliminating transient mount reports, while unsupported structural cells preserve the previous behavior.

Explicit suppression now clears previously published viewability tokens even when current cell metrics are unavailable. It also invalidates stale minimumViewTime work. Suppression propagates through deeper cross-orientation nesting, and parent registration is reconciled when orientation or context changes so unmount always cleans up the exact collection that was registered.

The implementation is kept in sync across the main, Windows, and macOS variants. The generated public API snapshot is updated accordingly.

Fixes #57797
Fixes #57778

Changelog:
[General][Fixed] - Do not report viewable items for a cross-orientation nested list while its parent row is off screen

Differential Revision: D117727511

@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 Sep 8, 2026
@meta-codesync

meta-codesync Bot commented Sep 8, 2026

Copy link
Copy Markdown

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

…8412)

Summary:

A horizontal `VirtualizedList` nested inside a vertical list could report its items through `onViewableItemsChanged` while the parent row was off screen. The existing same-orientation nesting path translates parent scroll metrics, but cross-orientation children have independent scroll axes and therefore need the visibility of their containing row as a separate signal.

Expose a semantic cell-visibility query through `VirtualizedListContext` and register cross-orientation children with the key of their containing cell. Parents evaluate those cells after scroll and layout changes, but invoke children only when the ancestor suppression state transitions. Known data rows without layout metrics fail closed, eliminating transient mount reports, while unsupported structural cells preserve the previous behavior.

Explicit suppression now clears previously published viewability tokens even when current cell metrics are unavailable. It also invalidates stale `minimumViewTime` work. Suppression propagates through deeper cross-orientation nesting, and parent registration is reconciled when orientation or context changes so unmount always cleans up the exact collection that was registered.

The implementation is kept in sync across the main, Windows, and macOS variants. The generated public API snapshot is updated accordingly.

Fixes react#57797
Fixes react#57778

Changelog:
[General][Fixed] - Do not report viewable items for a cross-orientation nested list while its parent row is off screen

Differential Revision: D117727511
@meta-codesync meta-codesync Bot changed the title Fix viewability reporting for cross-orientation nested lists Fix viewability reporting for cross-orientation nested lists (#58412) Sep 8, 2026
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-exported p: Facebook Partner: Facebook Partner

Projects

None yet

1 participant