Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Components panel has unintuitive display for components that match native HTML elements #807

Open
EliHowey opened this issue May 21, 2021 · 1 comment
Assignees
Labels

Comments

@EliHowey
Copy link

Angular DevTools version (required): 1.0.0

Angular version (required): 9.0.6

Link to a minimal stackblitz reproduction (strongly encouraged):
https://stackblitz.com/edit/angular-devtools-directive-matching

Description of issue:

When a native HTML element matches a @Component selector, the Angular DevTools Components panel lists the component by its native tag name in the component tree, and attributes the component's property values to the native element rather than the matching component class. This can lead to confusion about which component is matching an element, and about where inputs/outputs/properties are coming from.

In the following screenshot, the highlighted node matches an AuthFooterComponent with the selector footer[hamAuthFooter] and a property currentYear. Note how the component is listed as footer in both the component tree and the sidebar. (The link to the component's source code navigates to AuthFooterComponent as expected.)

Screen Shot 2021-05-21 at 12 52 59 AM

In the next screenshot, the highlighted link matches both LinkComponent (a[hlLink]) and ExternalLinkDirective (a[target="_blank"]). The element tree only indicates a match for ExternalLinkDirective, and it wouldn't be surprising if someone mistakenly thought that the input and property listed in the sidebar derived from ExternalLinkDirective, when they actually derive from LinkComponent.

Screen Shot 2021-05-21 at 12 13 04 AM

Steps to reproduce:

  1. Create a component whose selector matches a native HTML element (e.g., a[myComponent]).
  2. Observe how Angular DevTools represents that component in the Components panel.
@EliHowey EliHowey added the bug Something isn't working label May 21, 2021
@sumitarora sumitarora self-assigned this May 21, 2021
@mgechev
Copy link
Contributor

mgechev commented May 21, 2021

I'd change this to a feature request rather than an issue. The current behavior is by design, but I agree it could be confusing and we can change it.

@mgechev mgechev added feature and removed bug Something isn't working labels May 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants