diff --git a/src/lib/chips/chip/chip-adapter.ts b/src/lib/chips/chip/chip-adapter.ts index 85337602e..105bfe17b 100644 --- a/src/lib/chips/chip/chip-adapter.ts +++ b/src/lib/chips/chip/chip-adapter.ts @@ -13,6 +13,7 @@ import { replaceElement } from '../../core/utils/utils'; export interface IChipAdapter extends IBaseAdapter { readonly removeButtonElement: IIconButtonComponent | undefined; + readonly isAnchor: boolean; clickTrigger(): void; addRootListener(type: string, listener: EventListener): void; removeRootListener(type: string, listener: EventListener): void; @@ -28,6 +29,7 @@ export interface IChipAdapter extends IBaseAdapter { focusTrigger(options?: FocusOptions): void; tryFocusRemoveButton(): void; clickRemoveButton(): void; + animateStateLayer(): void; } @@ -53,6 +55,10 @@ export class ChipAdapter extends BaseAdapter implements IChipAda return this._removeButtonElement; } + public get isAnchor(): boolean { + return this._triggerElement.localName === 'a'; + } + public clickTrigger(): void { this._triggerElement.click(); } @@ -198,6 +204,10 @@ export class ChipAdapter extends BaseAdapter implements IChipAda this._removeButtonElement?.click(); } + public animateStateLayer(): void { + this._stateLayerElement.playAnimation(); + } + private _createRemoveButton(): IIconButtonComponent { const buttonEl = document.createElement('forge-icon-button'); buttonEl.density = 'small'; diff --git a/src/lib/chips/chip/chip-foundation.ts b/src/lib/chips/chip/chip-foundation.ts index d666b31ae..124a04b50 100644 --- a/src/lib/chips/chip/chip-foundation.ts +++ b/src/lib/chips/chip/chip-foundation.ts @@ -104,6 +104,9 @@ export class ChipFoundation implements IChipFoundation { } } else { this.click(); + if (this._adapter.isAnchor) { + this._adapter.animateStateLayer(); + } } break; case 'ArrowLeft':