Skip to content

Conversation

@eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Jan 13, 2026

Stacked on #35240

We used to only show a blank pane when no element is selected. This was ok when we only showed the inspected element pane in the Components and Suspense tab since you couldn't escape inspection.

However, when showing the inspected element pane in the browsers Elements panel, you can select elements that aren't owned by React and therefore won't inspect an element. Now we show a configurable fallback.

For the inspected element pane in the browser's Elements panel, we display "No element rendered by React selected.".

CleanShot 2026-01-13 at 16 20 50@2x

Otherwise "No React element selected."

CleanShot 2026-01-13 at 16 20 22@2x

Styling and layout is similar to the loading fallback but not dimmed since the fallback for no selection may be visible indefinitely.

@meta-cla meta-cla bot added the CLA Signed label Jan 13, 2026
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Jan 13, 2026
padding: 0.25rem;
color: var(--color-dimmer);
font-style: italic;
border-left: 1px solid var(--color-border);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placing the border here made the border only span a single line. Now the border is one the whole container while also not being duplicated if the parent already defines a border. This makes composition easier with regards to border drawing.

return (
<div className={styles.InspectedElement}>
<div className={styles.TitleRow} />
<div className={styles.NoInspectionFallback}>{fallbackEmpty}</div>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also show the loading fallback below the title row.

@eps1lon eps1lon force-pushed the sebbie/01-13-_devtools_show_fallback_in_inspected_element_pane_when_no_element_is_selected branch from 952f8ee to 51d62c9 Compare January 13, 2026 15:47
@eps1lon eps1lon marked this pull request as ready for review January 13, 2026 15:47
@eps1lon eps1lon requested a review from hoxyq January 13, 2026 15:47
@eps1lon eps1lon force-pushed the sebbie/01-13-_devtools_show_fallback_in_inspected_element_pane_when_no_element_is_selected branch from 51d62c9 to 2bc6bf4 Compare January 13, 2026 17:28
<div className={styles.InspectedElementPane}>
<InspectedElement
actionButtons={!hideSettings && <SettingsModalContextToggle />}
fallbackEmpty={'No element rendered by React selected.'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of right now, Chrome forces DOM element selection? In other words, you can't deselect an element, and when you open the panel, it preselect some element?

So if there is always a selection, maybe we could rephrase it to something like "Selected element wasn't rendered with React."?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I was trying to convey the same thing but your suggestion is less ambiguous.

<InspectedElementErrorBoundary>
<InspectedElement />
<InspectedElement
fallbackEmpty={'No React element selected.'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could leave a suggestion to the user here, something like "Select an element in the tree to inspect."

@eps1lon eps1lon force-pushed the sebbie/01-13-_devtools_show_fallback_in_inspected_element_pane_when_no_element_is_selected branch from 2bc6bf4 to 8e640ec Compare January 15, 2026 12:38
@eps1lon eps1lon force-pushed the sebbie/01-13-_devtools_show_fallback_in_inspected_element_pane_when_no_element_is_selected branch from 8e640ec to f261518 Compare January 15, 2026 12:40
@eps1lon eps1lon requested a review from hoxyq January 15, 2026 12:51
@eps1lon eps1lon merged commit bb8a76c into facebook:main Jan 15, 2026
234 checks passed
@eps1lon eps1lon deleted the sebbie/01-13-_devtools_show_fallback_in_inspected_element_pane_when_no_element_is_selected branch January 15, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants