-
Notifications
You must be signed in to change notification settings - Fork 1.3k
test: adds ShadowDOM / UNSAFE_PortalProvider tests #8806
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?
Changes from 7 commits
7a6dfcc
bbb7588
322c7cf
3098625
c636c8b
02deef6
2e0e86e
06a5380
a9b85aa
31b38f9
c543816
cc39458
dabe409
fc228f9
1f4a2ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,14 +54,14 @@ export function useFocusWithin(props: FocusWithinProps): FocusWithinResult { | |
|
||
let onBlur = useCallback((e: FocusEvent) => { | ||
// Ignore events bubbling through portals. | ||
if (!e.currentTarget.contains(e.target)) { | ||
if (!nodeContains(e.currentTarget as Element, e.target as Element)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (repeated): The fact that you have to add type assert highlights that suggestion: While Adobe hasn't gotten back to either of us since we restarted this work last week on whether they'd prefer a targeted approach or a universal approach, I can say that the changes I made to DomFunctions.ts are an improvement. |
||
return; | ||
} | ||
|
||
// We don't want to trigger onBlurWithin and then immediately onFocusWithin again | ||
// when moving focus inside the element. Only trigger if the currentTarget doesn't | ||
// include the relatedTarget (where focus is moving). | ||
if (state.current.isFocusWithin && !(e.currentTarget as Element).contains(e.relatedTarget as Element)) { | ||
if (state.current.isFocusWithin && !nodeContains(e.currentTarget as Element, e.relatedTarget as Element)) { | ||
state.current.isFocusWithin = false; | ||
removeAllGlobalListeners(); | ||
|
||
|
@@ -78,7 +78,7 @@ export function useFocusWithin(props: FocusWithinProps): FocusWithinResult { | |
let onSyntheticFocus = useSyntheticBlurEvent(onBlur); | ||
let onFocus = useCallback((e: FocusEvent) => { | ||
// Ignore events bubbling through portals. | ||
if (!e.currentTarget.contains(e.target)) { | ||
if (!nodeContains(e.currentTarget as Element, e.target as Element)) { | ||
return; | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.