[DevTools] Render the highlight overlay in the top layer #37823

Open
UditDewan opened 12:07am on October 13, 2026 wants to merge 10 Ξ” into facebook/react main from
devtools-overlay-top-layer

Pull Request Overview

  • Opened on October 13, 2026
  • Status Open
  • Commit count 2 with first commit October 13, 2026

Total Delta

10 Total Diff Delta

Open Days

Open 24 weekdays

Test Delta

0 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
N/A 25.8 days Issue creation to work beginning
 
0.0 days Authoring 1 commit before pull request opened for review
 
0.0 days Awaiting first review
 
24.0 days Revising work with 1 commit in response to 0 reviews that left 1 comment

Total time for pull request still awaiting merge (longer than repo's target): 24.0 business days

Author avatar

[DevTools] Render the highlight overlay in the top layer

Summary

Fixes #37534.

The element highlight overlay (used by the Inspect button and when hovering the Components tree) sits above the page with z-index: 10000000. A z-index can't stack anything above top layer elements, so when a modal <dialog> (opened with showModal()) is on screen, the overlay draws underneath it. When you inspect something inside the dialog, you get no highlight.

This makes the overlay container a popover="manual" element and calls showPopover() after mounting it, so the overlay also renders in the top layer. The TraceUpdates canvas already does the same thing (#32614). The default popover UA styles (border, padding, background, margin, overflow) are reset so the container itself stays an invisible 0Γ—0 box. pointer-events: none keeps it from intercepting clicks. Environments without the Popover API keep the existing z-index behavior.

How did you test this change?

I bundled the real Overlay.js (flow types stripped) into a page that opens a modal <dialog>, then used Playwright with Edge to compare screenshots of the dialog area before and after calling overlay.inspect() on an element inside the dialog:

overlay visible over the dialog
container in top layer (:popover-open)
container size

main
no
no
1280px wide (block div)

this PR
yes
yes
0Γ—0



  • yarn prettier, yarn linc


  • flow check for dom-node: no errors

Website or app

https://codesandbox.io/p/sandbox/ws7dp6

Repro steps

The Inspect button lets you lookup a component in the tree by clicking on it.

This is not working with top-layer elements, like <dialog> opened via showModal.

  1. Navigate to https://ws7dp6.csb.app/
  2. Open React Dev Tools > Components
  3. Click the Inspect button (there are two icons of a cursor inside a rectangle at the top left, the browser's built-in one works, the one in React Dev Tools does not)
  4. Click inside the dialog
  5. Notice that nothing is selected.

The issue is packages/react-devtools-shared/src/backend/views/Highlighter/Overlay.js:169 uses a really high z-index, instead of entering the top layer.

https://github.com/user-attachments/assets/3ea438f3-3362-4e37-9c81-8f9ffd0540b7

How often does this bug happen?

Every time

DevTools package (automated)

No response

DevTools version (automated)

No response

Error message (automated)

No response

Error call stack (automated)


Error component stack (automated)


GitHub query string (automated)


Comments Threads Pending Resolution

Resolved Comment Threads

No resolved comments have been left on this PR.