Skip to content

fix(devtools): highlight SVG and directive hosts correctly#69458

Open
AleksanderBodurri wants to merge 1 commit into
angular:mainfrom
AleksanderBodurri:devtools-highlighter-fixes
Open

fix(devtools): highlight SVG and directive hosts correctly#69458
AleksanderBodurri wants to merge 1 commit into
angular:mainfrom
AleksanderBodurri:devtools-highlighter-fixes

Conversation

@AleksanderBodurri

@AleksanderBodurri AleksanderBodurri commented Jun 22, 2026

Copy link
Copy Markdown
Member

This PR cleans up 4 issues with the Angular Devtools highlighter, 2 big, 2 small.

Bigger issues

  • Before SVG hosts could be skipped because the highlighter checked for HTMLElement. A case like would not get a proper overlay. The highlighter now works with Element so SVG hosts can be found and measured.

  • Before Directive only hosts could be skipped because the inspected-page lookup and directive explorer matched component hosts and component ids only. A case like Todos could highlight the parent component instead of the anchor, and the RouterLink only tree node could fail to select, highlight, or request an overlay. The lookup now stops at the nearest component or directive host, and tree matching accepts component and directive ids using null as the absent state.

Smaller issues

  • Selected overlays could fail to reappear for the same element because unhighlighting removed the overlay but left the selected element cached. selected-element cache is now reused only while its overlay is still connected, and unhighlighting clears the cached element.

  • Overlay geometry used integer coercion. An SVG or transformed element with a 0.5px bounding box could get a 0px overlay. Overlay positioning now preserves fractional DOMRect values.

@ngbot ngbot Bot added this to the Backlog milestone Jun 22, 2026
Before SVG hosts could be skipped because the highlighter checked for HTMLElement. A case like <foreignObject appSvgDemo> would not get a proper overlay. The highlighter now works with Element so SVG hosts can be found and measured.

Before Directive only hosts could be skipped because the inspected-page lookup and directive explorer matched component hosts and component ids only. A case like <a routerLink="/todos">Todos</a> could highlight the parent component instead of the anchor, and the RouterLink only tree node could fail to select, highlight, or request an overlay. Id 0 could also miss the highlighted state because the tree treated it as absent. The lookup now stops at the nearest component or directive host, and tree matching accepts component and directive ids using null as the absent state.

Selected overlays could fail to reappear for the same element because unhighlighting removed the overlay but left the selected element cached. selected-element cache is now reused only while its overlay is still connected, and unhighlighting clears the cached element.

Overlay geometry used integer coercion. An SVG or transformed element with a 0.5px bounding box could get a 0px overlay. Overlay positioning now preserves fractional DOMRect values.
@AleksanderBodurri AleksanderBodurri force-pushed the devtools-highlighter-fixes branch from a235a49 to 60d3ad4 Compare June 22, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant