Open chrisconover opened 9 years ago
autoClosedDisabled
does not seem to work for me either (0.5.2)
I am experiencing the same issue. :cry: :+1:
From the docs it looks like autoCloseDisabled is defined as
By default, the toast will close automatically if the user taps outside it or presses the escape key. Disable this behavior by setting the autoCloseDisabled property to true.
That's actually related to closing from user actions, not the dismiss after the duration. (It's used in core-overlay)
The code looks like:
openedChanged: function() {
if (this.opened) {
this.dismissJob = this.job(this.dismissJob, this.dismiss, this.duration);
} else {
this.dismissJob && this.dismissJob.stop();
this.dismiss();
}
},
You can see that it always dismisses after the given duration regardless of autoCloseDisabled. From what I see you could either set an infinite duration, or the code would have to be like below, but I'm not sure if that was the author's intention.
openedChanged: function() {
if (this.opened) {
if (this.autoCloseDisabled) return;
this.dismissJob = this.job(this.dismissJob, this.dismiss, this.duration);
} else {
this.dismissJob && this.dismissJob.stop();
this.dismiss();
}
},
The correct way to do is probably to add another attribute like disableDismiss that does this instead.
Same here in Polymer version 0.5.5
. A dirty workaround is to set duration to a stupid large milliseconds value!!!
Simply give the toast an attribute of duration="0". Then, whenever you open the toast, it will stick on the screen, unless you press the Esc key, for which Polymer has graciously given us an attribute called noCancelOnEscKey
Here's their documentation: https://www.webcomponents.org/element/PolymerElements/paper-toast/paper-toast
I'm trying to create a paper-toast that is sticky in the UI until I explicitly tell it to close.
The docs suggest using the attribute autoCloseDisabled to accomplish this, but in my experience it doesn't have any effect and the toast automatically dismisses after 3 seconds.
Simple example: http://codepen.io/chrisconover/pen/zxoQXG
I realize that I can set the duration to a really high integer, but this seems like a hack.
Is anyone else running into this?