Re: [w3ctag/design-reviews] Other Spec Review: Service Worker Capability Delegation for Pop-ups (Issue #1295)

dmurph left a comment (w3ctag/design-reviews#1295)

Quick update from our DevTrial: our partner (Gmail) tested the prototype end-to-end and confirmed it works well for their notification-click popup flow.

The trickiest ergonomics issue we ran into during testing is **activation / feature detection** (and how it interacts with the `notificationclick` window-interaction allowance), so we'd especially love the TAG's thoughts here:

- Because `PostMessageOptions` is a WebIDL dictionary, browsers that don't implement `delegate` silently ignore `{delegate: 'popup'}` rather than throwing `NotSupportedError` (which only throws in a browser that parses `delegate` but doesn't support `'popup'`). There's also no prototype property to inspect.
- This matches existing Capability Delegation (`payment`, `fullscreen`, `display-capture`, `digital-credentials-*`), which doesn't have a detection API today. However, the gap bites slightly harder here: in a `notificationclick` handler, calling `await client.focus()` first consumes the Service Worker's single window-interaction allowance. If `{delegate: 'popup'}` is silently ignored and the client's `window.open()` is blocked, the worker can't fall back to `clients.openWindow()` afterward.
- Without explicit detection, developers are left with either browser-version checks (`navigator.userAgentData`) or an awkward one-time no-op `client.postMessage(..., {delegate: 'popup'})` probe outside a `notificationclick` (checking for `NotAllowedError`).

We'd appreciate your input on whether you think we should:
1. **Stay consistent with existing Capability Delegation** (no detection API in this proposal; treat detection as a separate repo-wide question).
2. **Add a lightweight, side-effect-free query** — e.g., a static `supportsDelegation(capability)` method (paralleling `HTMLScriptElement.supports()` / `ClipboardItem.supports()`) or a `FrozenArray<DOMString>` like `supportedDelegations` (paralleling `PerformanceObserver.supportedEntryTypes`).
3. **Explore an event-scoped shape** (e.g., a method/option tied directly to `NotificationEvent`), which would give prototype-based feature detection and per-event scoping together, at the cost of diverging from the existing `postMessage(..., {delegate})` pattern.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/1295#issuecomment-7330395389
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/issues/1295/7330395389@github.com>

Received on Wednesday, 2 December 2026 00:19:33 UTC