W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2019

[csswg-drafts] [css-mediaqueries] Proposal: "navigation-controls" (#4187)

From: Jay Harris via GitHub <sysbot+gh@w3.org>
Date: Mon, 12 Aug 2019 00:14:15 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-479430466-1565568853-sysbot+gh@w3.org>
fallaciousreasoning has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-mediaqueries] Proposal: "navigation-controls" ==
## Overview
This API is being proposed as a way to eliminate the "double back button" problem (seen [here](https://github.com/fallaciousreasoning/backbutton-mediaquery/blob/master/images/double-back-button.jpg), on Twitters PWA in the Microsoft store). This problem arises because developers of [ `"standalone"` ,  `"fullscreen"` , and  `"minimal-ui"` ](https://www.w3.org/TR/appmanifest/#display-modes) apps 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 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.

## Example Usage
```css
/* Hide the back button if the browser provides any navigation controls. */
@media (navigation-controls) {
    #back-button {
        display: none;
    }
}

/* 
 * Make the back button green if the browser is not showing any navigation controls.
 * Note: This will not match unless the user agent understands the media query, even
 * if no controls are being shown.
 */
@media (navigation-controls: none) {
    #back-button {
        background: green;
    }
}

/*
 * Make the back button red if the browser is showing one too.
 * Note: If this query matches then @media (navigation-controls)
 * will too.
 */
@media (navigation-controls: back) {
    #back-button {
        background: red;
    }
}
```

## Relevant Links:
[Initial Issue](https://github.com/w3c/manifest/issues/693) (from @mgiuca)
[Explainer](https://github.com/fallaciousreasoning/backbutton-mediaquery/blob/master/explainer.md)
[Discourse Thread](https://discourse.wicg.io/t/proposal-back-button-media-query/3802)

## CC
@mustjab

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4187 using your GitHub account
Received on Monday, 12 August 2019 00:14:17 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:52 UTC