feat(devtools): improve "hover to inspect" and shadow root compat #25518
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.
fix #25519
Summary
I made two changes in this PR.
event.composed
to detect if an event is originated in a ShadowRoot (which the real target is not reflected onevent.target
, butevent.composedPath()[0]
).pointermove
instead ofpointerover
to detect the latest hovering element. This change also related to the ShadowRoot,in this case,
pointerover
won't fire correctly (for the devtools use case) in order to select the latest hovering element.When you hover on
div.a
,pointerover
will fire ondiv.root
becausediv.a
is inside a ShadowRoot, then,when the hover target changed to
div.b
, no newpointerover
event will be fired because the hover target is still inside the same ShadowRoot.How did you test this change?