Notifications: cannot navigate into link via keybindings (fix #163086) (#167980)

This commit is contained in:
Benjamin Pasero
2022-12-06 07:28:32 +01:00
committed by GitHub
parent e79a401ba5
commit 9df51e1cdd
3 changed files with 28 additions and 15 deletions

View File

@@ -825,6 +825,12 @@ export interface EventLike {
stopPropagation(): void;
}
export function isEventLike(obj: unknown): obj is EventLike {
const candidate = obj as EventLike | undefined;
return !!(candidate && typeof candidate.preventDefault === 'function' && typeof candidate.stopPropagation === 'function');
}
export const EventHelper = {
stop: <T extends EventLike>(e: T, cancelBubble?: boolean): T => {
e.preventDefault();