Skip to content

Commit c37b3d8

Browse files
authored
fix(toast): toast does not warn when positionAnchor is undefined (#28312)
1 parent 8450564 commit c37b3d8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

core/src/components/toast/toast.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,14 @@ export class Toast implements ComponentInterface, OverlayInterface {
412412
private getAnchorElement(): HTMLElement | undefined {
413413
const { position, positionAnchor, el } = this;
414414

415+
/**
416+
* If positionAnchor is undefined then
417+
* no anchor should be used when presenting the toast.
418+
*/
419+
if (positionAnchor === undefined) {
420+
return;
421+
}
422+
415423
if (position === 'middle' && positionAnchor !== undefined) {
416424
printIonWarning('The positionAnchor property is ignored when using position="middle".', this.el);
417425
return undefined;

0 commit comments

Comments
 (0)