-
Notifications
You must be signed in to change notification settings - Fork 50.5k
[DevTools] Update inspected element on component filter changes #35599
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?
[DevTools] Update inspected element on component filter changes #35599
Conversation
|
Now thinking a bit more about it, I am not quite sure about this change. I believe the main use case for filters is to hide a bunch of unnecessary things from the tree, but this also has side effects on selecting the lowest React node that owns the corresponding DOM element. We don't keep filtered-out nodes in a store, right? I thought maybe we could fork |
What side-effects? The intention here was to select a lower element if you don't filter host components.
yes. Could you explain why that is a problem here? |
When selecting React element that owns some DOM element, we will select lowest unfiltered, not just the lowest. Although from user perspective, the filters feature could only be applied to the actual React tree that you see on Components panel, the current state is a bit unexpected / confusing to me, but this is subjective.
Maybe we should keep filtered nodes in a store, I don't know. Maybe these filters should only apply to the visual representation of the tree on the Components panel, and if you use this React pane on Elements panel, it should always use the full tree representation. |
That's what I meant to convey with "lowest". If it would select the lowest, it would just select the element itself.
That's a pretty big refactor. I don't see how this PR contradicts that. I consider this mostly a UX bug fix since we didn't update the view when we update the filter. Right now you have to click back and forth which seems worse than automatically updating the view. |
It totally makes sense for the Element pane case, but I think at the same time it adds an unpredictable behaviour on Components panel. I can be wrong, but I would expect the following scenario to be possible:
I am not blocking this change, I feel like it perfectly makes sense for the case with pane on Elements panel. Maybe we should rethink the filters as a feature in a future. |
Summary
We used to only update the inspected element when selected host element changes. This is fine when Components and the browser's Elements panel are alternate. With the inspected element pane you can now have the inspected element and browsers Elements panel side-by-side.
Now we update the inspected element when the filter changes. This is mostly interestiny when the filter becomes less restrictive i.e. we can inspect an element closer to the selected host element. When the filter becomes more restrictive, the store was already selecting the nearest parent.
The new behavior may be disorienting if you're in the Components panel so we could restrict the behavior to apply only when you're changing filter from within the inspected elements pane within the browsers Elements panel.
CleanShot.2026-01-22.at.14.54.22.mp4
How did you test this change?