-
Notifications
You must be signed in to change notification settings - Fork 26.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(devtools): switch to components tab whenever the inspector is used #60694
base: main
Are you sure you want to change the base?
Conversation
…s used Switch to the components tab, if not there, when a component is selected via the inspector.
@@ -95,6 +95,13 @@ export class DevToolsTabsComponent { | |||
this.routes.set(routes || []); | |||
}); | |||
|
|||
// Change the tab to Components, if an element is selected via the inspector. | |||
this._messageBus.on('selectComponent', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Just for my understanding, when is this event emitted? How does a user select a component outside of the UI? Is there an ng
global API which triggers this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess my description was not very clear. Basically, when you are on a different tab from Components, using the inspector, which is available for use irrespective of the tab you're on, doesn't redirect you to the Components tab. The PR makes the behavior identical to Chrome DevTools element inspector where using the inspector from the Network tab, for example, will redirect you back to Elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I didn't realize the inspector button was available on different tabs, makes sense that we should switch to the Components tab when used.
(Related: Maybe it shouldn't be available on other tabs? 🤔)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's handy. Personally, I find myself occasionally using the element inspector from tabs different from Elements. Plus, it's consistent with Chrome DevTools.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the new behavior?
Switch to the Components tab, if on a different tab, when a component is selected via the inspector.
cc @dgp1130
Does this PR introduce a breaking change?