feat(core): highlight and inspect views from DevTools by edusperoni · Pull Request #11689 · NativeScript/NativeScript
Repository navigation
feat(core): highlight and inspect views from DevTools - #11689
Draft
edusperoni wants to merge 4 commits into main from feat/debugger-layout-inspection
Draft
feat(core): highlight and inspect views from DevTools #11689 edusperoni wants to merge 4 commits into main from feat/debugger-layout-inspection
Conversation
edusperoni commented Nov 30, 2026 · edited Loading
Copy link Copy Markdown
Contributor
PR Checklist
- The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/main/tools/notes/CONTRIBUTING.md#commit-messages .
- There is an issue for the bug/feature this PR is for. To avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it.
- You have read and signed the CLA (first-time contributors can sign directly on the PR by commenting
I have read the CLA and I hereby sign the CLA). - All existing tests are passing: https://github.com/NativeScript/NativeScript/blob/main/tools/notes/DevelopmentWorkflow.md#unit-testing .
- Tests for the changes are included - https://github.com/NativeScript/NativeScript/blob/main/tools/notes/WritingUnitTests.md .
What is the current behavior?
The Elements panel shows the view tree, but there is no link between it and the screen. Chrome DevTools highlights and inspects through the Overlay domain, which core doesn't implement: Overlay.enable fails, hovering a node highlights nothing, and inspect mode does nothing. DOM.getBoxModel, DOM.getNodeForLocation and DOM.pushNodesByBackendIdsToFrontend fail too, and every node reports backendNodeId: 0, so the frontend can't map a backend node to the tree.
There is also no way to get from a node in Elements to the view itself: DOM.resolveNode is a stub and $0 is always undefined.
What is the new behavior?
Highlight. Hovering a node in Elements highlights its view on the device, with margin, border, padding and content bands in the colors DevTools asks for. It clears when the pointer leaves or the view unloads.
Inspect. In inspect mode, touching the device highlights the view under the finger, and lifting it selects that view in Elements. The touch doesn't reach the app, and inspect mode ends after one pick.
Geometry for the frontend.
DOM.getBoxModelreturns margin, border, padding and content quads in window DIPs.DOM.getNodeForLocationreturns the deepest visible view at a point.DOM.pushNodesByBackendIdsToFrontendis implemented, and nodes now report abackendNodeIdequal to theirnodeId.
References to views. The runtimes serialize domain handler results to JSON, so a handler can't return a remote object. DevTools clients get the view through Runtime.evaluate instead:
$0is the node selected in Elements (DOM.setInspectedNode).__inspector.getViewById(nodeId)is the view behind a node id. A DevTools proxy can answerDOM.resolveNodewith it.__inspector.getRootView()is the app's root view, so tools such as Angular DevTools need no code in the app.
Geometry and hit testing are shared code in debugger/devtools-layout.ts. Drawing and touch interception are per platform in debugger/devtools-screen.{ios,android}.ts. Everything is loaded through inspector_modules.
Testing
- Unit tests:
core:testpasses (789 passed, 1 skipped), including 11 new tests for the box decomposition, highlight bands, hit testing and view references.core:buildpasses. - iOS (iPhone 16 Pro simulator, iOS 26.3) and Android (Galaxy S20 FE, Android 13), with a Chromium 156 DevTools frontend:
- Hovering a node draws the highlight on the device, and the bands match the view's margin, border, padding and content.
- Tapping a view in inspect mode selects it in Elements.
$0and__inspector.getViewByIdgive the view.
- Android only: taps 3 dp inside opposite corners of three views select the right one, a tap in inspect mode doesn't reach the app, and touches work again after a pick or a cancel.
Known limitations
- Views inside modals don't resolve to a node, because modals aren't part of the inspected document.
- If DevTools disconnects while inspect mode is on, the device keeps intercepting touches until the next pick or the next
Overlay.enable. The debugger modules get no disconnect notification. - Percentage margins aren't shown on Android, because the native layout params hold their resolved value only while measuring.
DOM.resolveNodeitself is still a stub. Answering it natively needs a runtime change (V8InspectorSession::wrapObject).
feat(core): DOM box model, node-at-location and backend node ids for ...
c917a78
...the inspector Adds DOM.getBoxModel, DOM.getNodeForLocation and DOM.pushNodesByBackendIdsToFrontend. Box quads are in window DIPs, built from the view's location, size and effective margins, borders and paddings. Nodes now report backendNodeId equal to nodeId so the frontend can resolve backend ids from Overlay events and screencast inspect.
feat(core): Overlay domain with native highlight and tap-to-inspect
c56ed02
Implements Overlay.enable/disable, highlightNode, highlightRect, hideHighlight and setInspectMode, plus successful no-ops for the setShow* family and setPausedInDebuggerMessage that the frontend sends on attach. Highlights draw as colored content/padding/border/margin bands above the app: a non-interactive view on the window on iOS, the decor view's overlay on Android. They go away on hideHighlight or when the view unloads. In searchForNode mode a full-window view swallows touches: dragging highlights the view under the finger and emits Overlay.nodeHighlightRequested; lifting emits Overlay.inspectNodeRequested and leaves inspect mode on the device, since the frontend exits it locally without sending mode none. Overlay.enable resets the state so a reconnecting frontend never inherits a touch-blocking interceptor.
nx-cloud
Bot
commented
Nov 30, 2026
·
edited
Loading
Copy link Copy Markdown
|
View your CI Pipeline Execution ↗ for commit 25bd9cd
💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗ ☁️ Nx Cloud last updated this comment at |
pkg-pr-new
Bot
commented
Nov 30, 2026
·
edited
Loading
Copy link Copy Markdown
commit: |
feat(core): references to inspected views for DevTools clients
b1438cb
fix(core): include margins in the inspector's box model on Android
25bd9cd
This branch has not been deployed
No deployments
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment