Skip to content

Reflect the application context in the display-mode media feature - #1218

Merged
dmurph merged 14 commits into
mainfrom
installed-media-feature
Oct 26, 2026
Merged

dmurph merged 14 commits into
mainfrom
installed-media-feature

Conversation

@marcoscaceres

@marcoscaceres marcoscaceres commented May 11, 2026 •

Copy link
Copy Markdown
Member

Closes #1092

Requires the user agent to reflect whether the top-level traversable is an application context through the application value of the display-mode media feature. This follows the CSS Working Group's review in w3c/csswg-drafts#14125 ("Request for review: application-context media feature (Web App Manifest)"). It depends on a Media Queries 5 change, not yet written, that defines the application value and lets more than one display-mode value match at once. It replaces the separate application-context media feature this PR originally added.

This change (choose at least one, delete ones that don't apply):

  • Adds new normative requirements

Implementation commitment (delete if not making normative changes):

Commit message:

Reflect the application context in the display-mode media feature

Documents can query (display-mode: application), to be defined in Media Queries 5, to detect whether they are running in an application context.


Preview | Diff

Comment thread index.html Resolved
Comment thread index.html Resolved
@marcoscaceres

Copy link
Copy Markdown
Member Author

@copilot, can you fix the indenting on the <pre>s, including the examples. And remove the section that's not needed (see my suggestions)

Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved

@dmurph dmurph left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on manifest editor meeting chat, we can remove the re-statements of manifest application on browsing contexts, as the definition of an installed web application imlpies that - e.g. it must be true if installed web application is true.

Other than that, the intention here lgtm and I'm sure there are small style things that can be fixed. but other than queueing an event (which I think marcos has in a comment) directionally lgtm

Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved
Comment thread index.html Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds specification text for a new installed CSS media feature to let documents detect whether the current top-level traversable is running as an installed web application (application context), including cross-origin iframe behavior and privacy considerations.

Changes:

  • Defines the installed media feature with installed/none values and boolean usage semantics.
  • Adds normative requirements for cross-origin nested documents and for updating media query evaluation on transitions.
  • Documents privacy properties and includes examples for CSS and matchMedia() usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread index.html Resolved
@kyerebo

kyerebo commented May 26, 2026

Copy link
Copy Markdown

Awesome to see that we're adding normative spec text for installed media feature, thank you for the work here!

Without being aware we were looking to merge this; I recently had taken a crack at an explainer/WICG proposal for this at WICG/proposals#288

My current proposal is that we shift from a boolean media feature to an enumerated one, for reasons outlined in the Explainer (namely context clarity and extensibility). Do you think that would make sense to reflect in the spec text here, or do we have compelling reasoning for having a boolean feature?

@marcoscaceres marcoscaceres added the BLOCKED Blocked for some reason label Oct 9, 2026
@marcoscaceres

Copy link
Copy Markdown
Member Author

BLOCKED on MQ5 spec text.

@kyerebo

kyerebo commented Oct 9, 2026 •

Copy link
Copy Markdown

Yup, I'll open a PR on the CSSWG for the spec text! Would appreciate a cursory look on the initial draft PR that I throw up there so that we can iterate on exact wording and behavior before I add specific CSS WG reviewers.

UPDATE - PR is here: w3c/csswg-drafts#14587

@kyerebo

kyerebo commented Oct 16, 2026

Copy link
Copy Markdown

BLOCKED on MQ5 spec text.

@marcoscaceres w3c/csswg-drafts#14587 has merged!

@marcoscaceres

Copy link
Copy Markdown
Member Author

Ok, nice! We should have at least one implementation proving it works before we merge. I’ll try to update the WebKit PR this week.

@cmzz

cmzz commented Oct 20, 2026

Copy link
Copy Markdown

I maintain [openpwa.net](https://openpwa.net), where I track PWA compatibility across browsers. There's another compatibility issue worth highlighting here.

Firefox 143+ on Windows uses displayMode = "minimal-ui" for its taskbar web apps, switching back to "browser" when the app is opened as a regular tab. This means (display-mode: standalone) returns false even when the site is running as an installed web app.

On iOS 26+, websites added to the Home Screen now open as web apps by default, even without a manifest. But detecting that context still relies on platform-specific behavior like navigator.standalone.

So developers can't simply check (display-mode: standalone) to determine whether a site is running as an app. They need to account for multiple display modes and browser-specific differences.

I think the underlying issue is that we're using display modes to detect application context, even though these are two different things.

A single application value, independent of how the app is displayed, would make this much simpler and more consistent across browsers.

I've documented the Firefox behavior and implementation details here:

https://openpwa.net/reference/platforms/firefox-taskbar-web-apps/

marcoscaceres added a commit to marcoscaceres/WebKit that referenced this pull request Oct 21, 2026
…ture

https://bugs.webkit.org/show_bug.cgi?id=314609
rdar://176851836

Reviewed by NOBODY (OOPS!).

`display-mode: application` matches when a web application manifest is applied or the Standalone setting is on. It matches alongside the display mode the page already reports, as Media Queries 5 now allows. With the Standalone setting on and no manifest, the page reports `standalone`.

Spec changes:
w3c/manifest#1218
w3c/csswg-drafts#14587
@marcoscaceres

Copy link
Copy Markdown
Member Author

WebKit has an implementation ready for review: WebKit's pull request. It turned up two problems. The fixes are up in Media Queries 5: browser and cross-origin frames. I'd keep this PR blocked until we settle them.

Media Queries 5 says browser only applies outside an application context. This spec says a page whose manifest has no display member is an application context in browser mode. Both can't hold.

Media Queries 5 also says embedded frames match the top-level page, so any frame, from any site, can tell the page is an installed app.

@marcoscaceres

Copy link
Copy Markdown
Member Author

@cmzz thanks. That is the value this pull request adds. (display-mode: application) matches whenever the top-level page is an application context, whatever display mode the window reports. A window that reports minimal-ui, as you describe for Firefox's taskbar windows, can match too.

Your iOS 26 example needs one more fix. This spec counts a page as an application context only when a manifest is applied, so an app that the browser makes without a manifest did not clearly count. Let user agents process a manifest for a document with no manifest link closes that gap.

@benfrancis

Copy link
Copy Markdown
Member

@marcoscaceres wrote:

Media Queries 5 says browser only applies outside an application context. This spec says a page whose manifest has no display member is an application context in browser mode. Both can't hold.

Just a suggestion, but could one solution be to deprecate the browser display mode in the manifest specification? This may seem drastic, but does any user agent actually implement an application context with browser display mode as distinct to an ordinary browsing context? I've never been clear on the difference. Are there any implementations that apply any other manifest members if the display mode is browser? I realise that it's currently the default display mode in the fallback chain, but in practice is there actually any difference between a browsing context and an application context with browser display mode?

@dmurph
dmurph force-pushed the installed-media-feature branch from f9a44ae to 14aab0b Compare October 26, 2026 16:03
@dmurph
dmurph merged commit d943bfe into main Oct 26, 2026
2 checks passed
github-actions Bot added a commit that referenced this pull request Oct 26, 2026
…1218)

SHA: d943bfe
Reason: push, by dmurph

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BLOCKED Blocked for some reason TPAC2026 Proposed for discussion at TPAC 2026 (Dublin)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Way to detect if a web app is installed (in the app)

7 participants