Skip to content

Commit e0096ef

Browse files
JeanMecheAndrewKushnir
authored andcommitted
refactor(devtools): prevent dblclick on the expand arrow to show the element panel (#54912)
This will improve the UX PR Close #54912
1 parent 54de0f3 commit e0096ef

2 files changed

Lines changed: 19 additions & 13 deletions

File tree

‎devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/directive-forest/directive-forest.component.html‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,21 @@
2121
(mouseleave)="removeHighlight()"
2222
[style.padding-left]="15 + 15 * node.level + 'px'"
2323
>
24-
<div class="tree-node-info">
25-
@if (node.expandable) {
26-
<button
27-
[style.left]="15 * node.level + 'px'"
28-
(click)="treeControl.toggle(node)"
29-
[attr.aria-label]="'toggle ' + node.name"
30-
>
31-
<mat-icon class="mat-icon-rtl-mirror">
32-
{{ treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}
33-
</mat-icon>
34-
</button>
35-
}
36-
<span class="element-name" [class.angular-element]="isElement(node)">{{ node.name }}</span>
24+
<div class="tree-node-info">
25+
@if (node.expandable) {
26+
<!-- We stop propagration on dblClick to prevent to show the element panel -->
27+
<button
28+
[style.left]="15 * node.level + 'px'"
29+
(click)="treeControl.toggle(node)"
30+
(dblclick)="stopPropagation($event)"
31+
[attr.aria-label]="'toggle ' + node.name"
32+
>
33+
<mat-icon class="mat-icon-rtl-mirror">
34+
{{ treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right' }}
35+
</mat-icon>
36+
</button>
37+
}
38+
<span class="element-name" [class.angular-element]="isElement(node)">{{ node.name }}</span>
3739

3840
@if (node.directives) {
3941
<span class="dir-names">[{{ node.directives }}]</span>

‎devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/directive-forest/directive-forest.component.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ export class DirectiveForestComponent {
344344
}
345345
}
346346

347+
stopPropagation(event: Event): void {
348+
event.stopPropagation();
349+
}
350+
347351
private _findMatchedNodes(): number[] {
348352
const indexesOfMatchedNodes: number[] = [];
349353
for (let i = 0; i < this.dataSource.data.length; i++) {

0 commit comments

Comments
 (0)