[w3c/manifest] Shortcut item should have an "id" field (Issue #1020)

This is kind of similar to how we just added the ["id" field](https://www.w3.org/TR/appmanifest/#id-member); it's a small scale version of the same problem.

Problem: There isn't a stable identifier for shortcuts. That means if the user agent wants to associate any persistent information with a shortcut, with a lifetime that persists across manifest updates, there is no way to properly know in the new manifest, which shortcut corresponds to a shortcut from the old manifest.

Two concrete use cases:

- User drags a shortcut from the app context menu to the home screen (this is already possible on Chrome for Android, and I'm not sure how they've dealt with this problem).
- The user agent wants to associate info with a shortcut, for example, how many times the user has used that shortcut, in order to rank it in a search results page.

What if the manifest updates, and the shortcut's user-facing string name, icon and/or URL changes? How does the user agent retain the information associated with the shortcut, and know which shortcut in the new manifest it corresponds to?

(More directly: what member of [_shortcut item_](https://www.w3.org/TR/appmanifest/#dfn-shortcut-item) should the user agent use as the primary key in the database for the above two use cases?)

Currently, the most likely candidate for a primary key is either the name or the URL. But both of those can plausibly change while the underlying semantics of that shortcut remain the same.

Proposal: Like with the app ID, we need an explicit field to serve as a stable identifier for a shortcut item. This field would be a user-unfriendly string (never seen by the user), which is expected never to change across manifest versions, even if the name, URL and other metadata changes. It would be considered to uniquely identify the shortcut within this particular app (so the tuple of `(app-id, shortcut-id)` globally uniquely identifies the shortcut). Its default value could be the name or URL, or just say if unsupplied then it's up to the user agent.

TODO: What does Chrome for Android do here? Note that you can install the [Twitter PWA](https://twitter.com/) on Android, long-press its icon, drag "New Tweet" to the home screen, and have a persistent button to open that shortcut. What happens if Twitter changes the name or URL associated with that shortcut?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/1020

Received on Thursday, 25 November 2021 05:20:16 UTC