File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 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 {
9393 /** The projected chip edit input. */
9494 @ContentChild ( MatChipEditInput ) contentEditInput ?: MatChipEditInput ;
9595
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+ */
97103 _alreadyFocused = false ;
98104
105+ _isEditing = false ;
106+
99107 constructor ( ...args : unknown [ ] ) ;
100108
101109 constructor ( ) {
@@ -110,6 +118,7 @@ export class MatChipRow extends MatChip implements AfterViewInit {
110118 } ) ;
111119 this . _onFocus . pipe ( takeUntil ( this . destroyed ) ) . subscribe ( ( ) => {
112120 if ( ! this . _isEditing && ! this . disabled ) {
121+ // Need a timeout to ensure flag not set while handling the first click.
113122 this . _ngZone . runOutsideAngular ( ( ) => {
114123 setTimeout ( ( ) => ( this . _alreadyFocused = true ) , 100 ) ;
115124 } ) ;
You can’t perform that action at this time.
0 commit comments