mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
fix(toast): toast does not warn when positionAnchor is undefined (#28312)
This commit is contained in:
@ -412,6 +412,14 @@ export class Toast implements ComponentInterface, OverlayInterface {
|
|||||||
private getAnchorElement(): HTMLElement | undefined {
|
private getAnchorElement(): HTMLElement | undefined {
|
||||||
const { position, positionAnchor, el } = this;
|
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) {
|
if (position === 'middle' && positionAnchor !== undefined) {
|
||||||
printIonWarning('The positionAnchor property is ignored when using position="middle".', this.el);
|
printIonWarning('The positionAnchor property is ignored when using position="middle".', this.el);
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user