Skip to content

Commit b385734

Browse files
stevenyxudevversion
authored andcommitted
minor tweak to mdc chips adapter for latest upstream update to unbreak pantheon
angular already manages focus fully and this hook does negligible good and a lot of harm (e.g., focusing thigns that were never meant to be focused). long term we probably want to consolidate the code, but for now just keep it unbroken. squash this commit into the main PR
1 parent 064e09d commit b385734

File tree

1 file changed

+7
-4
lines changed
  • src/material-experimental/mdc-chips

1 file changed

+7
-4
lines changed

src/material-experimental/mdc-chips/chip.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
249249
// specify whether selection occurred via user input.
250250
},
251251
notifyNavigation: () => {
252-
// TODO: This is a new feature added by MDC, consider exposing this event to users in the
253-
// future.
252+
// TODO: This is a new feature added by MDC; consider exposing this event to users in the
253+
// future.
254254
},
255255
notifyTrailingIconInteraction: () => this.removeIconInteraction.emit(this.id),
256256
notifyRemoval: () => this.removed.emit({chip: this}),
@@ -262,8 +262,11 @@ export class MatChip extends _MatChipMixinBase implements AfterContentInit, Afte
262262
hasLeadingIcon: () => !!this.leadingIcon,
263263
hasTrailingAction: () => !!this.trailingIcon,
264264
isRTL: () => !!this._dir && this._dir.value === 'rtl',
265-
focusPrimaryAction: () => this._elementRef.nativeElement.focus(),
266-
focusTrailingAction: () => this.trailingIcon && this.trailingIcon.focus(),
265+
focusPrimaryAction: () => {
266+
// Angular Material MDC chips fully manage focus. TODO: Managing focus and handling keyboard
267+
// events was added by MDC after our implementation; consider consolidating.
268+
},
269+
focusTrailingAction: () => {},
267270
setTrailingActionAttr: (attr, value) =>
268271
this.trailingIcon && this.trailingIcon.setAttribute(attr, value),
269272
setPrimaryActionAttr: (name: string, value: string) => {

0 commit comments

Comments
 (0)