Skip to content

chore: Improve type detection and node contains logic for shadow dom#10287

Open
snowystinger wants to merge 3 commits into
mainfrom
improve-internal-types
Open

chore: Improve type detection and node contains logic for shadow dom#10287
snowystinger wants to merge 3 commits into
mainfrom
improve-internal-types

Conversation

@snowystinger

Copy link
Copy Markdown
Member

Closes

Attempting to pull out some portions of #10102

This PR improves the internal types for some of our helper functions, allowing us to remove some casts. It also changes the detection for nodeContains with shadowDOM slotted components.
And it also changes some of the logic around our detection of various elements to make them SSR safe and accept a wider range of input.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

@rspbot

rspbot commented Jul 2, 2026

Copy link
Copy Markdown

@rspbot

rspbot commented Jul 2, 2026

Copy link
Copy Markdown
## API Changes

@react-aria/utils

/@react-aria/utils:getOwnerDocument

 getOwnerDocument {
-  el: Element | null | undefined
+  target?: EventTarget | null
   returnVal: undefined
 }

/@react-aria/utils:getOwnerWindow

 getOwnerWindow {
-  el: (Window & any) | Element | null | undefined
+  target?: EventTarget | null
   returnVal: undefined
 }

/@react-aria/utils:isShadowRoot

 isShadowRoot {
-  node: Node | null
+  value: unknown
   returnVal: undefined
 }

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants