Adding Installed Media Query Explainer#1315
Conversation
|
|
||
| ## Introduction | ||
|
|
||
| The **`installed` CSS media feature** provides a reliable, boolean signal indicating whether the current document is running inside an installed web application window. It evaluates to `true` when the document is in an application context (a top-level browsing context with a manifest applied, presented in its own app window) and `false` otherwise. |
There was a problem hiding this comment.
I don't think I've seen another MQ use "yes" and "no" as keywords. Is there precedence for this?
I wonder if instead we could format the MQ such that it describes the kind of host (not sure what the right terminology would be here, so please feel free to update based on your knowledge of the space)
@media (host-type: installed) { }
Then you'd have one for a non-installed type (the name of which I think should be fairly generic and not actually tied to the installed state). The benefit of this is that it could then be extended to other kinds of hosting environments in the future
There was a problem hiding this comment.
Looking into this a bit further, I see for binary values we don't really use "yes/no".
I think a cleaner way is to have the media query check for presence as a boolean-style feature, so something like
@media (installed) { ... }
@media not (installed) {...}
this feels more straight-forward and self-describing to me.
If we wanted to push for an enumerated MQ, we could go for something like
@media (app-context: installed)
@media (app-context: browser)
We could also have both options in the explainer for now and leave it to CSSWG for a preferred direction to emerge during incubation.
WDYT?
There was a problem hiding this comment.
I somewhat like the app-context approach since it allows for more extensibility in the future (whereas a strictly boolean approach would be limited and couldn't really be added to in the future). But I don't think including both would be a concern (and one could even be included in the other ideas considered section)
| } | ||
| ``` | ||
|
|
||
| This feature separates the concept of "running as an installed app" from the app's current display mode, solving a long-standing gap in the web platform where developers lacked a clean, stable signal for installation state. |
There was a problem hiding this comment.
If you update the intro based on the section above, I think it'd be useful to dive into the concept of "the app's current display mode" and what that solution is, and why that isn't sufficient
There was a problem hiding this comment.
Do you mean moving the contents of the "The display-mode Problem" section to the introduction?
There was a problem hiding this comment.
Sorry, my wording there was confusing (even I'm confused :)) When I was originally reading the intro, I wasn't sure what was meant by "from the app's current display mode" so I think what I meant was giving more context on that in the intro to make that clearer (since it wasn't clear to me why that was insufficient or what it was).
But you could also keep that short and say the thing authors are trying to do and don't have a consistent way to do it, and dive into those existing solutions elsewhere. Up to you. But this was more so around ensuring enough context for the concepts introduced in the intro.
| - **Showing app-specific UI** (e.g., a title bar, back navigation, or "open in browser" link) that only makes sense in an app window. | ||
| - **Adapting layout** for the app window's chrome (or lack thereof). | ||
|
|
||
| ### The `display-mode` Problem |
There was a problem hiding this comment.
Since these are called out in alternatives considered, perhaps the intro could call these out briefly, and link to alternatives considered for more details, which would allow this section to be simplified
There was a problem hiding this comment.
Making sure I understand the suggestion- simplify the intro section by removing the user-facing problems, mentioning the problems in the intro section, and linking them to alternatives considered?
There was a problem hiding this comment.
Yeah touching on them in the intro, and leaving more details for these for that section (not sure if you need to link, but depending on how it is worded, you could link to that section, too)
|
|
||
| ## Goals | ||
|
|
||
| - Provide a **stable, boolean signal** for "running in an installed app window" that is separate from display mode. |
There was a problem hiding this comment.
Maybe we can note a declarative and imperative signal here and remove the second bullet altogether
There was a problem hiding this comment.
I could do something like Provide a **stable, boolean signal** for "running in an installed app window" that is separate from display mode that covers declarative and imperative use cases
I feel like we could be losing some clarity here though for simplification. Wdyt?
There was a problem hiding this comment.
I was thinking of something like "Provide a declarative and imperative stable, boolean signal for "running in an installed app window" that is separate from display mode."
But now that I see it, I think that may be a lot to include in one bullet. I see now that one is more about it being stable, and the second is about having imperative and declarative, so that makes sense.
I was just thinking when I originally read it that "Require no new JavaScript API." felt more like a non-goal, so perhaps if that one is worded to say something like the signal should have an imperative and declarative option, that may help make the second one feel more like a goal rather than a non-goal
|
|
||
| <!-- TODO: Add feedback from other browser vendors and web developers as discussions progress. --> | ||
|
|
||
| | Stakeholder | Position | Notes | |
There was a problem hiding this comment.
Is this a new suggestion for explainers? If not, I don't think this is needed and can be tracked in ChromeStatus instead (so you don't need to update this in more than one place)
There was a problem hiding this comment.
It's at the bottom of the template for explainers here https://github.com/w3ctag/explainer-explainer/blob/main/template.md
Do you think we can omit it regardless?
There was a problem hiding this comment.
Interesting, maybe I haven't noticed it before. Yeah I think you can exclude it in this case. Might be an interesting call out for things where there is known pushback, but I think we can just rely on ChromeStatus for this one
The installed CSS media feature provides a reliable, boolean signal indicating whether the current document is running inside an installed web application window. It evaluates to true when the document is in an application context (a top-level browsing context with a manifest applied, presented in its own app window) and false otherwise.