Skip to content

Commit

Permalink
fix(popover): use composed path for trigger element target (ionic-tea…
Browse files Browse the repository at this point in the history
  • Loading branch information
mixalbl4-127 committed Jan 8, 2022
1 parent 388622f commit 09b6c6b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/components/popover/animations/ios.enter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const iosEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation =>
const contentEl = root.querySelector('.popover-content') as HTMLElement;
const arrowEl = root.querySelector('.popover-arrow') as HTMLElement | null;

const referenceSizeEl = trigger || ev?.detail?.ionShadowTarget || ev?.target;
const referenceSizeEl = trigger || ev?.detail?.ionShadowTarget || ev?.composedPath?.()?.[0] || ev?.target;
const { contentWidth, contentHeight } = getPopoverDimensions(size, contentEl, referenceSizeEl);
const { arrowWidth, arrowHeight } = getArrowDimensions(arrowEl);

Expand Down
2 changes: 1 addition & 1 deletion core/src/components/popover/animations/md.enter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const mdEnterAnimation = (baseEl: HTMLElement, opts?: any): Animation =>
const root = getElementRoot(baseEl);
const contentEl = root.querySelector('.popover-content') as HTMLElement;

const referenceSizeEl = trigger || ev?.detail?.ionShadowTarget || ev?.target;
const referenceSizeEl = trigger || ev?.detail?.ionShadowTarget || ev?.composedPath?.()?.[0] || ev?.target;
const { contentWidth, contentHeight } = getPopoverDimensions(size, contentEl, referenceSizeEl);

const defaultPosition = {
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/popover/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ export const getPopoverPosition = (
* to the indicator rather than `ion-breadcrumb`
* as a whole.
*/
const actualTriggerEl = (triggerEl || customEv?.detail?.ionShadowTarget || customEv?.target) as HTMLElement | null;
const actualTriggerEl = (triggerEl || customEv?.detail?.ionShadowTarget || customEv?.composedPath?.()?.[0] || customEv?.target) as HTMLElement | null;
if (!actualTriggerEl) {
return defaultPosition;
}
Expand Down

0 comments on commit 09b6c6b

Please sign in to comment.