test(focus-scope): shadow root issue example #2331
Draft
+158
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#1667
This is a reproduction branch about the focus isse mentionnedn in #1667 :
What is not working
When rendering a
Dialogcomponent (or anything that can be teleported) into the shadow root.Then rendering another component that will update the DOM (here a combobox opening a list) at some point.
If we have the focus on the inner component (e.g. combobox) when the DOM is updated, we loose the focus.
How to reproduce
pnpm story:devExpected behaviour
The focus should not be lost.
Here is an example of how it should behave.
Note
Here everything is teleported into the body so it's working. It would be nice to have it working inside the shadow-root:
Screen.Recording.2025-12-10.at.11.41.27.mp4
Faulty behaviour
Here, everything is mounted into shadow-root, the portal target as well. So the
Dialogoverlay and content will mount inside the portal-target within shadow root. TheComboboxwill be mounted inside theDialogcontent, and its list will be rendered inline.The focus is lost when we start typing and the list is shown:
Screen.Recording.2025-12-10.at.11.40.14.1.mp4