'requireInteraction' property of chrome.notifications ignored when user locks screen, sleeps, changes users
Reported by zman...@gmail.com, Oct 19 2016
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.59 Safari/537.36 Steps to reproduce the problem: 1. create a chrome.notifications.create with requireInteraction true 2. in Windows 10, lock the screen. 3. Unlock the screen What is the expected behavior? The notifications should still be showing on the screen, as the user has not done any action to them. What went wrong? The notifications are gone. Did this work before? No Does this work in other browsers? N/A Chrome version: 54.0.2840.59 Channel: stable OS Version: 10.0 Flash Version: Shockwave Flash 23.0 r0 This is a common scenario because the screen can be locked automatically in many ways, for example when putting the computer to sleep or switching users. I found the issue while attempting to migrate out of chrome panels which were just removed from Chrome. Panels used to provide always-on-top functionality, and the only possible way to now do this is with a chrome notification.
Oct 19 2016,
I have found a workarround for this issue. However, it still seems that Chrome should not be auto-closing notifications that requireInteraction. The workarround is to listen on chrome.notifications.onClosed, which provides a "byUser" boolean. It adds complexity as it requires tracking auto-closed notifications (skipping those closed by code, but not those closed by the system or by the user), and keeping an interval to try and bring them back to live.
Oct 19 2016,
regarding the workarround mentioned above: It only works if the user has not closed all chrome windows. Consider this scenario: 1) page shows a notification with requireInteraction 2) user closes chrome windows 3) after a while, user sleeps (manually or no battery, or hibernates, etc) result: when the user comes back, chrome is no longer running. this is because I assume chrome said goodbye after all notifications were auto-closed. Since chrome isnt running, the workarround code cannot execute, thus the notification will not come back to the screen. In short: my workaround only mitigates this issue's side-effects. The only way to truly not lose the notification is for Chrome not to kill them on such system events.
Oct 20 2016,
on Mac OSX it does not happen. So far its on Windows 10.
Oct 23 2017,
Issue has not been modified or commented on in the last 365 days, please re-open or file a new bug if this is still an issue. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Sign in to add a comment