-
Notifications
You must be signed in to change notification settings - Fork 50.4k
[DevTools] Add React Element pane to browser Elements panel #35240
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
[DevTools] Add React Element pane to browser Elements panel #35240
Conversation
29c965a to
c63fec5
Compare
eb49d8f to
98337e1
Compare
98337e1 to
3bcc570
Compare
packages/react-devtools-shared/src/devtools/views/InspectedElement/InspectedElementPane.js
Outdated
Show resolved
Hide resolved
packages/react-devtools-shared/src/devtools/views/InspectedElement/InspectedElementPane.js
Outdated
Show resolved
Hide resolved
|
|
||
| const elementsPanel = chrome.devtools.panels.elements; | ||
| if (!elementsPanel || !elementsPanel.createSidebarPane) { | ||
| // TODO: Does Firefox support elements panel extensions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, does it work on Firefox? It probably should - https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools/panels/elements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C&P from the added sources pane which isn't supported in Firefox. The right compat table is https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools/panels/ElementsPanel/createSidebarPane. So we should still leave the check in case we ever distribute this for Safari.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reminder. It actually doesn't work in Firefox due to https://bugzilla.mozilla.org/show_bug.cgi?id=2010549
| inspectedElementPane = createdPane; | ||
|
|
||
| createdPane.setPage('panel.html'); | ||
| createdPane.setHeight('75px'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it used as a min-height or how does this work? Might be worth double-checking the case when an element has a long list of props or hooks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was copied from the added sources pane. Though it's not supported in Firefox: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/devtools/panels/ExtensionSidebarPane#browser_compatibility
I follow-up on this since whatever change we make, should affect all ExtensionSidebarPane.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually will do this now since I can't test Firefox otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do in a follow-up since Firefox support is blocked by https://bugzilla.mozilla.org/show_bug.cgi?id=2010549
Closes #32574
Adds a dedicated pane for inspecting the React Element that rendered the inspected DOM element.
The main motivation is having an affordance to open the source where the DOM element is rendered.
CleanShot.2025-11-28.at.00.25.16.mp4
The new pane has three UX quirks:
I feel like this should trigger de-selection instead
[DevTools] Clear element inspection if host element not owned by any renderer is selected #35504
So far no fallback was good enough for the Components and Suspense tab because you couldn't escape React Elements in those tabs. In the browsers Elements panel it's much easier to do so a fallback is warranted. Probably fine to add the fallback in every context.
[DevTools] Show fallback in inspected element pane when no element is selected #35503
I don't have a solution for that yet. Maybe that's fine in the end and it's something you get used to. The main problem right now is that initial load ignores the users setting and hides host Elements by default. Fixing that particular bug might help this issue the most.
I'll work on 1 and 2 in follow-ups that should be handled before the next release. For 3, I want to investigate why the initial load always uses the default filter and if we can fix that.
Other follow-ups before release: