Read the statement by Michael Teeuw here.
MM Default Alert Module Overlay Does not Go Away When Clicked
-
Hi @contactmike1 I have checked the issue and reproduced it, I can confirm that it is a bug. I will create GitHub issue and will solve it as well.
The issue is because alert.js is not getting call back from Notificationfx.js when it is dismissed by user, In case of timer it is working fine.
Here in code below we are not assigning onClose call back handler (It should also set with right context).
this.alerts[sender.name] = new NotificationFx({ message: image + message, effect: this.config.alert_effect, ttl: params.timer, al_no: "ns-alert" });
Below notification handler is calling the callback when user dismisses it or it is dismissed by code.
NotificationFx.prototype.dismiss = function () { this.active = false; clearTimeout(this.dismissttl); this.ntf.classList.remove("ns-show"); setTimeout(() => { this.ntf.classList.add("ns-hide"); // callback this.options.onClose(); //< ----------- }, 25);
-
@contactmike1 Pull request at https://github.com/MichMich/MagicMirror/pull/2229
-
@ashishtank Hey this is great!
I figured if I was lucky, someone might toss me a snippet to add to my code, but I’m very impressed someone wants to update the Master.
I wasn’t sure if this really amounted to an issue/bug since touchscreen/nav isn’t really the intended use of MM. I’ll pull in the new code once it gets merged. Thanks!
-
@contactmike1 Sure, if there is a possibility to dismiss the alert by clicking on it then it should work correctly (should hide the overlay as well). More over people are also using MM with touch screen using IR frame so it should any ways work.
You can add below one line in your code in alert.js file if you do not want to wait for merge in master.
//Store alert in this.alerts this.alerts[sender.name] = new NotificationFx({ message: image + message, effect: this.config.alert_effect, ttl: params.timer, onClose: () => this.hide_alert(sender), //< - add this line, with out this comment al_no: "ns-alert" });
-
Thanks Man! I am on holiday, but I will do this when I get back. It will work beautifully now!