File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -93,9 +93,17 @@ export class MatChipRow extends MatChip implements AfterViewInit {
93
93
/** The projected chip edit input. */
94
94
@ContentChild ( MatChipEditInput ) contentEditInput ?: MatChipEditInput ;
95
95
96
- _isEditing = false ;
96
+ /**
97
+ * Set with a timeout when the chips has been focused via mouse or keyboard.
98
+ *
99
+ * This allows us to ensure chip is already focused when deciding whether to enter the
100
+ * edit mode on a subsequent click. Otherwise, the chip appears focused when handling the
101
+ * first click event.
102
+ */
97
103
_alreadyFocused = false ;
98
104
105
+ _isEditing = false ;
106
+
99
107
constructor ( ...args : unknown [ ] ) ;
100
108
101
109
constructor ( ) {
@@ -110,6 +118,7 @@ export class MatChipRow extends MatChip implements AfterViewInit {
110
118
} ) ;
111
119
this . _onFocus . pipe ( takeUntil ( this . destroyed ) ) . subscribe ( ( ) => {
112
120
if ( ! this . _isEditing && ! this . disabled ) {
121
+ // Need a timeout to ensure flag not set while handling the first click.
113
122
this . _ngZone . runOutsideAngular ( ( ) => {
114
123
setTimeout ( ( ) => ( this . _alreadyFocused = true ) , 100 ) ;
115
124
} ) ;
You can’t perform that action at this time.
0 commit comments