commit 83db5891addec70bea19f8e5d4387d8aef77b29b Author: Dhruv Srivastava Date: Mon Oct 5 14:49:38 2020 +0200 Allow events to pass detail when using dispatchEventThroughTarget Change-Id: I690b9b3fd645939afa135bdc7cca0adb4f37b6ea diff --git a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.ts b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.ts index a3233be..90dac88 100644 --- a/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.ts +++ b/polygerrit-ui/app/elements/shared/gr-hovercard/gr-hovercard-behavior.ts @@ -193,10 +193,12 @@ export const hovercardBehaviorMixin = dedupingMixin( * Hovercard elements are created outside of , so if you want to fire * events, then you probably want to do that through the target element. */ - dispatchEventThroughTarget(eventName: string) { + dispatchEventThroughTarget(eventName: string, detail?: unknown) { + if (!detail) detail = {}; if (this._target) this._target.dispatchEvent( new CustomEvent(eventName, { + detail, bubbles: true, composed: true, }) @@ -463,7 +465,7 @@ export interface GrHovercardBehaviorInterface { removeListeners(): void; debounceHide(): void; cancelHideDebouncer(): void; - dispatchEventThroughTarget(eventName: string): void; + dispatchEventThroughTarget(eventName: string, detail?: unknown): void; hide(e?: MouseEvent): void; debounceShow(): void; debounceShowBy(delayMs: number): void;