How to close notification after reply?
FluorescentHallucinogen opened this issue · comments
Steps to reproduce:
- Open https://tests.peter.sh/notification-generator/
- Allow to show notifications in the browser permission prompt
- Select "One action (type text)" in the "Actions" dropdown menu
- Click "Display the notification" button
- Receive the notification and click "Reply" action button
- Type something
- Click "Send" icon
Expected behavior:
The notification should close after clicking on "Send" icon
Current behavior:
If "Close it?" checkbox is unchecked, after clicking on "Send" icon it becomes a spinner that spins endlessly. The notification won't close.
If "Close it?" checkbox is checked, after clicking on "Send" icon the typed text is added at the top, you can click "Reply" action button again, type something, and click "Send" icon, this text is also added at the top. The notification won't close.
Question
How to close the notification after reply? Should I return a promise in notificationclick
event listener in addition to event.notification.close()
or something else?
Is it a bug in Chrome for Android? The notification successfully closes in Chrome on Windows after clicking "Reply" action button (in both cases, if "Close it?" checkbox is checked or unchecked):
@beverloo @gauntface @anitawoodruff Please help me figure it out. 😉
Just found that if notificationclick
event listener has event.notification.close()
inside, then on some Android devices the notification successfully closes after clicking on "Send" icon, but on some not, the typed text is just added at the top.
This is exactly the same as the behavior of native Android apps on these devices. I've tested in Telegram. On some Android devices the notification successfully closes after clicking on "Send" icon, but on some not, the typed text is just added at the top.
But if notificationclick
event listener has no event.notification.close()
inside, then after clicking on "Send" icon it becomes a spinner that spins endlessly, the notification won't close on all Android devices.
@beverloo I think this is a bug, the spinner shouldn't spin endlessly, the notification should close (after some timeout). Could you please confirm?
Just found a very similar problem on StackOverflow: https://stackoverflow.com/q/51815139.
That certainly sounds like an issue on certain builds of Android—this is one of Chrome's manual test cases iirc. The intended behaviour in the spec (& in Chrome's implementation) is that calling notification.close()
always closes the notification.
@beverloo Could you please try to reproduce it yourself on your Android devices and your https://tests.peter.sh/notification-generator/ test page? But just remember, we are talking only about the notification inline reply case.
As I said, there are 2 problems:
- If there is
event.notification.close()
, the"Send" icon becomes a spinner that spins endlessly, and the notification won't close. - If there is no
event.notification.close()
, the typed text is just added at the top, and the notification won't close.
@beverloo I've opened https://crbug.com/1290426.