From c37b3d8bf4b440506fdc96455a532c6316e5673d Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Mon, 9 Oct 2023 16:41:11 -0400 Subject: [PATCH] fix(toast): toast does not warn when positionAnchor is undefined (#28312) --- core/src/components/toast/toast.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/src/components/toast/toast.tsx b/core/src/components/toast/toast.tsx index 9a14b2bfd0..b7945400b5 100644 --- a/core/src/components/toast/toast.tsx +++ b/core/src/components/toast/toast.tsx @@ -412,6 +412,14 @@ export class Toast implements ComponentInterface, OverlayInterface { private getAnchorElement(): HTMLElement | undefined { const { position, positionAnchor, el } = this; + /** + * If positionAnchor is undefined then + * no anchor should be used when presenting the toast. + */ + if (positionAnchor === undefined) { + return; + } + if (position === 'middle' && positionAnchor !== undefined) { printIonWarning('The positionAnchor property is ignored when using position="middle".', this.el); return undefined;