fix(popover): only focus trap ion-item children (#24990)

Resolves #24633
This commit is contained in:
Sean Perkins
2022-04-12 17:33:27 -04:00
committed by GitHub
parent 2a313e9117
commit 0cd06a6754
3 changed files with 242 additions and 131 deletions

View File

@ -337,6 +337,14 @@ export const configureKeyboardInteraction = (popoverEl: HTMLIonPopoverElement) =
const activeElement = document.activeElement as HTMLElement | null;
let items: HTMLIonItemElement[] = [];
const targetTagName = (ev.target as HTMLElement)?.tagName;
/**
* Only handle custom keyboard interactions for the host popover element
* and children ion-item elements.
*/
if (targetTagName !== 'ION-POPOVER' && targetTagName !== 'ION-ITEM') {
return;
}
/**
* Complex selectors with :not() are :not supported
* in older versions of Chromium so we need to do a
@ -353,7 +361,7 @@ export const configureKeyboardInteraction = (popoverEl: HTMLIonPopoverElement) =
) as NodeListOf<HTMLIonItemElement>
);
/* eslint-disable-next-line */
} catch {}
} catch { }
switch (ev.key) {
/**