Skip to content

[DevTools] Show fallback in inspected element pane when no element is selected#332

Closed
everettbu wants to merge 3 commits into
mainfrom
sebbie/01-13-_devtools_show_fallback_in_inspected_element_pane_when_no_element_is_selected
Closed

[DevTools] Show fallback in inspected element pane when no element is selected#332
everettbu wants to merge 3 commits into
mainfrom
sebbie/01-13-_devtools_show_fallback_in_inspected_element_pane_when_no_element_is_selected

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of facebook/react#35503
Original author: eps1lon


Stacked on react/react#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.

@everettbu everettbu added CLA Signed React Core Team Opened by a member of the React Core Team labels Jan 13, 2026
@greptile-apps

greptile-apps Bot commented Jan 13, 2026

Copy link
Copy Markdown

Greptile Summary

Added configurable fallback messages when no React element is selected in the inspected element pane. Previously showed blank pane, now displays context-appropriate messages: "Selected element wasn't rendered with React." for browser Elements panel, "No React element selected. Select an element in the tree to inspect." for Components tab, and "No React element selected. Select a Suspense boundary in the minimap to inspect." for Suspense tab.

  • Introduced required fallbackEmpty prop to InspectedElement component
  • Added NoInspectionFallback CSS class for fallback styling (italic, padded, no dimming)
  • Refactored border styling: moved border-left from InspectedElement to parent InspectedElementWrapper for consistent appearance across states
  • All three usage sites properly provide fallback messages

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Clean implementation with no breaking changes. All usages of InspectedElement component properly updated with required prop. CSS refactoring is straightforward and improves consistency. Changes are well-scoped to UI presentation only.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react-devtools-shared/src/devtools/views/Components/InspectedElement.js Added required fallbackEmpty prop to display message when no element is selected
packages/react-devtools-shared/src/devtools/views/Components/Components.js Passed context-appropriate fallback message to InspectedElement component
packages/react-devtools-shared/src/devtools/views/InspectedElement/InspectedElementPane.js Provided fallback message for browser Elements panel context

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@everettbu
everettbu 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 18:19

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

import {SettingsModalContextController} from 'react-devtools-shared/src/devtools/views/Settings/SettingsModalContext';
import styles from './InspectedElementPane.css';

export type Props = {};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

selectedSource prop is passed in DevTools.js line 387 but not defined in Props type or used in component

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/react-devtools-shared/src/devtools/views/InspectedElement/InspectedElementPane.js
Line: 21:21

Comment:
`selectedSource` prop is passed in `DevTools.js` line 387 but not defined in Props type or used in component

How can I resolve this? If you propose a fix, please make it concise.

@everettbu
everettbu force-pushed the sebbie/01-13-_devtools_show_fallback_in_inspected_element_pane_when_no_element_is_selected branch from 2bc6bf4 to f261518 Compare January 15, 2026 13:23
@everettbu

Copy link
Copy Markdown
Author

Upstream PR was closed or merged. Code is synced via branch mirror.

@everettbu everettbu closed this Jan 15, 2026
@everettbu
everettbu deleted the sebbie/01-13-_devtools_show_fallback_in_inspected_element_pane_when_no_element_is_selected branch January 15, 2026 14:13
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