-
Notifications
You must be signed in to change notification settings - Fork 50.5k
Add text node support to FragmentInstance operations #35630
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
base: main
Are you sure you want to change the base?
Conversation
|
Comparing: 3e319a9...17dc288 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show |
d5d0740 to
17dc288
Compare
| return false; | ||
| }); | ||
| if (hasText && !hasElement) { | ||
| console.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be console.error?
| while (i !== (resolvedAlignToTop ? -1 : children.length)) { | ||
| const child = children[i]; | ||
| // For text nodes, use Range API to scroll to their position | ||
| if (enableFragmentRefsTextNodes && child.tag === HostText) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually gate with just the flag
if (enableFragmentRefsTextNodes) {
if (child.tag === HostText) {
// ...
}
}
This PR adds text node support to FragmentInstance operations, allowing fragment refs to properly handle fragments that contain text nodes (either mixed with elements or text-only).
Not currently adding/removing new text nodes as we don't need to track them for events or observers in DOM. Will follow up on this and with Fabric support.
Support through parent element
dispatchEventcompareDocumentPositiongetRootNodeSupport through Range API
getClientRects: Uses Range to calculate bounding rects for text nodesscrollIntoView: Uses Range to scroll to text node positions directlyNo support
focus/focusLast/blur: Noop for text-only fragmentsobserveUsing: Warns for text-only fragments in DEVaddEventListener/removeEventListener: Ignores text nodes, but still works on Fragment level throughdispatchEvent