notifications icon indicating copy to clipboard operation
notifications copied to clipboard

Are notification click events handled as "activation triggering input event"?

Open saschanaz opened this issue 1 year ago • 0 comments

What is the issue with the Notifications API Standard?

Browsers have some code to handle focus/popup from notification click:

  • Blink calls NotifyUserActivation on Notification::OnClick https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/notifications/notification.cc;l=256?q=notification.cc
  • WebKit uses WindowFocusAllowedIndicator inside Notification::dispatchClickEvent https://searchfox.org/wubkat/rev/2ac974dfc4125439eb1ee0f2ed39bdefef15395e/Source/WebCore/Modules/notifications/Notification.cpp#348-351
  • Gecko uses StartClearWindowTimer for SW notificationclick https://searchfox.org/mozilla-central/rev/dca2603d55b5b39d3b8ab8e93c08b42563f5aad8/dom/serviceworkers/ServiceWorkerOp.cpp#906-908 and WantsPopupControlCheck for NotificationEvent https://searchfox.org/mozilla-central/rev/dca2603d55b5b39d3b8ab8e93c08b42563f5aad8/dom/notification/NotificationEvent.h#43

But I don't see how that's mapped in the spec. As Service Worker spec requires transient user activation for WindowClient.focus and WindowClient.openWindow, the notification spec should also say something about transient user activation.

The HTML spec has activation triggering input event which lists keydown/mousedown/pointerdown/pointerup/touchend. Maybe that list should be extended and cover ServiceWorker too?

cc @smaug----

saschanaz avatar Oct 24 '24 13:10 saschanaz