Navigation-controls media query
- Category
- CSS
- Type
- New or changed feature
- Status
- Proposed (Chrome Proposed)
- Intent stage
- Start prototyping
WPT details: No tests for this feature yet.
Summary
Adds 'navigation-controls' media feature, which is used to detect if the user agent has a back button present in the UI.
Motivation
PWAs today have no way of determining whether a back button will be provided by the user agent (the browser, OS, or hardware), and so, are forced to implement their own to ensure that their app is functional without the browser's UI. This media feature will allow apps to avoid the "double back button" problem by letting them conditionally display a back button depending on whether the user agent is already displaying one. Adding a standard way to detect this means that we can avoid user-agent and viewport-size workarounds, which are not ideal for web compatibility.
Standards & signals
- Specification: https://www.w3.org/TR/mediaqueries-5/#nav-controls
- Firefox: Positive — The CSSWG discussed the proposal and resolved to add it to MQ5 spec.
- Safari: Positive — The CSSWG discussed the proposal and resolved to add it to MQ5 spec.
- Web developers: No signals
- Tracking bug: https://bugs.chromium.org/p/chromium/issues/detail?id=822994
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=navigation-controls-media-query
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+Navigation-controls%20media%20query
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=Navigation-controls%20media%20query
- Baseline status: https://webstatus.dev/?q=Navigation-controls%20media%20query
Docs: https://github.com/w3c/csswg-drafts/issues/4187 https://github.com/fallaciousreasoning/backbutton-mediaquery
Explainers: https://github.com/fallaciousreasoning/backbutton-mediaquery/blob/master/explainer.md