mirror of
https://github.com/goauthentik/authentik.git
synced 2026-06-18 03:19:51 +03:00
76ca2fbf77
* web: Table row refinements (#17659) * web: Reset selection state after refresh. * web: Only select row when not expandable. * web: Only render expandable content when row is expanded. * web: Use `repeat` directive. * web: Fix nested pointer event detection. * web: Fix issues surrounding stale table rows. * Port row selector fix. --------- Co-authored-by: Teffen Ellis <592134+GirlBossRush@users.noreply.github.com> Co-authored-by: Teffen Ellis <teffen@goauthentik.io>
30 lines
948 B
TypeScript
30 lines
948 B
TypeScript
const InteractiveElementsQuery =
|
|
"[href],input,button,[role='button'],select,[tabindex]:not([tabindex='-1'])";
|
|
|
|
/**
|
|
* Whether a pointer event is targeting the element itself or one of its children.
|
|
*
|
|
* @param event The pointer event to check.
|
|
* @returns Whether the event is targeting the element or one of its children.
|
|
*/
|
|
export function isEventTargetingListener(event?: Pick<Event, "target" | "currentTarget">): boolean {
|
|
const { target: triggerElement, currentTarget: listenerTarget } = event ?? {};
|
|
|
|
if (!triggerElement || !listenerTarget) {
|
|
return false;
|
|
}
|
|
|
|
if (!(triggerElement instanceof HTMLElement) || !(listenerTarget instanceof HTMLElement)) {
|
|
return false;
|
|
}
|
|
|
|
if (triggerElement === listenerTarget) {
|
|
return false;
|
|
}
|
|
|
|
return !!(
|
|
triggerElement.matches(InteractiveElementsQuery) ||
|
|
triggerElement.parentElement?.matches(InteractiveElementsQuery)
|
|
);
|
|
}
|