react/packages/react-devtools-shell
YongSeok Jang (장용석) 53c9f81049
[DevTools] Use Popover API for TraceUpdates highlighting (#32614)
## Summary

When using React DevTools to highlight component updates, the highlights
would sometimes appear behind elements that use the browser's
[top-layer](https://developer.mozilla.org/en-US/docs/Glossary/Top_layer)
(such as `<dialog>` elements or components using the Popover API). This
made it difficult to see which components were updating when they were
inside or behind top-layer elements.

This PR fixes the issue by using the Popover API to ensure that
highlighting appears on top of all content, including elements in the
top-layer. The implementation maintains backward compatibility with
browsers that don't support the Popover API.

## How did you test this change?

I tested this change in the following ways:

1. Manually tested in Chrome (which supports the Popover API) with:
- Created a test application with React components inside `<dialog>`
elements and custom elements using the Popover API
- Verified that component highlighting appears above these elements when
they update
- Confirmed that highlighting displays correctly for nested components
within top-layer elements

2. Verified backward compatibility:
- Tested in browsers without Popover API support to ensure fallback
behavior works correctly
- Confirmed that no errors occur and highlighting still functions as
before

3. Ran the React DevTools test suite:
   - All tests pass successfully
   - No regressions were introduced

[demo-page](https://devtools-toplayer-demo.vercel.app/)
[demo-repo](https://github.com/yongsk0066/devtools-toplayer-demo)

### AS-IS

https://github.com/user-attachments/assets/dc2e1281-969f-4f61-82c3-480153916969

### TO-BE

https://github.com/user-attachments/assets/dd52ce35-816c-42f0-819b-0d5d0a8a21e5
2025-05-07 15:48:17 +01:00
..
src [DevTools] Use Popover API for TraceUpdates highlighting (#32614) 2025-05-07 15:48:17 +01:00
constants.js chore[devtools]: upgrade to webpack v5 (#26887) 2023-06-14 13:15:52 +01:00
e2e-regression.html DevTools] e2e Regression Testing App (#24619) 2022-05-26 11:36:00 -04:00
e2e.html Refactored DevTools test shell for e2e (#22968) 2021-12-15 11:42:59 -05:00
index.html [DevTools] add perf regression test page in shell (#25078) 2023-01-04 17:31:13 -05:00
multi.html DevTools: Support mulitple DevTools instances per page (#22949) 2021-12-14 12:16:16 -05:00
package.json chore[devtools]: upgrade to webpack v5 (#26887) 2023-06-14 13:15:52 +01:00
perf-regression.html [DevTools] add perf regression test page in shell (#25078) 2023-01-04 17:31:13 -05:00
README.md [devtools] 1st class support of used Thenables (#32989) 2025-04-24 13:46:31 +02:00
webpack-server.js [devtools] 1st class support of used Thenables (#32989) 2025-04-24 13:46:31 +02:00

Harness for testing local changes to the react-devtools-inline and react-devtools-shared packages.

Development

This target should be run in parallel with the react-devtools-inline package. The first step then is to run that target following the instructions in the react-devtools-inline README's local development section.

The test harness can then be run as follows:

cd packages/react-devtools-shell

yarn start

Once you set both up, you can view the test harness with inlined devtools in browser at http://localhost:8080/