Re: [w3c/clipboard-apis] Add comprehensive clipboardchange event specification with ClipboardChangeEventInit dictionary (PR #239)

@zgroza commented on this pull request.



> @@ -224,12 +227,166 @@ url: https://w3c.github.io/permissions/#permissions-task-source; type: dfn;
    * Scripts that use the [[#async-clipboard-api]] to write to the clipboard
    * Actions that update the clipboard outside the user agent
 
-   If the clipboard contents are changed outside the user agent, then the
-   {{GlobalEventHandlers/clipboardchange}} event MUST fire when the user agent regains focus.
+   <div class="algorithm" data-algorithm="fire-clipboardchange-event">
+   <h5 id="h-fire-clipboardchange-event">To fire a clipboardchange event</h5>
+
+   To <dfn export>fire a clipboardchange event</dfn> given a {{Document}} <var>document</var>:
+
+   1. If <var>document</var> does not have [=sticky activation=] and <var>document</var> does not have permission to read from the clipboard, then return.
+
+   2. Let <var>global</var> be <var>document</var>'s [=relevant global object=].
+
+   3. If <var>document</var> has [=system focus=]:
+    1. Let <var>types</var> be a list of [=mandatory data types=] available on the [=system clipboard=].
+    2. Let <var>changeId</var> be a unique identifier for this clipboard change, generated by applying a partition-specific transformation to a system-level clipboard change identifier, ensuring that different [=partitions=] receive different identifiers for the same clipboard change while maintaining consistency within the same [=partition=].

I would rather opt for pinning this to the appropriate local storage's storage shelf than the key. In this way we would handle the arguably partition-changing event of user deleting site data. Key won't change, but if we for example either
* put a new `UUID` within the relevant shelves on each system clipboard change
* always provide as `changeId` the hash of some browser-wide `changeId` against `UUID` of the shelf itself

the stability of this ID will be bound to the local storage.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/pull/239#discussion_r2338017510
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/clipboard-apis/pull/239/review/3207976521@github.com>

Received on Wednesday, 10 September 2025 22:04:14 UTC