-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Honor media attribute #955
Comments
We are working to make I think one of the challenges with having multiple manifests is that you then have to maintain those separate manifests, which makes it more likely they will get out of sync. Your use case is light/dark mode, but there are all high contrast media queries and the potential for exponential manifests as different media queries for screen size, etc. get applied (e.g., a different manifest for small screens vs. large ones). Setting aside the potential maintenance headache for the developer when it comes to maintenance, there’s also the complexity this creates for implementors (having to track which manifest should apply in which scenario) and there’s also the possibility users could get wildly different app experiences based on which manifest is loaded (e.g., different manifests get applied based on whether DevTools is open or not). I think the use case outlined (color modes) is worth addressing (which is why I am pursuing it for Would love to hear thoughts from @marcoscaceres @kenchris @mgiuca and @christianliebel on this as well. |
The behavior of
So, looks like we get dark mode support for free 🎉 |
I noticed that as well @marcoscaceres. It does seem a bit like a house of cards, however. Related:
Now matrix that by color modes, different screen res, etc. and I guess I just feel like there should be a better solution for developers that would allow them to simplify their approach. In terms of the manifest (and assuming
It feels like replicating every other key in the manifest to achieve a consistent dark mode is problematic. I think it’d be worth brainstorming another approach, either by modifying the manifest or by allowing CSS to "pierce the veil" into app representation via standardized custom properties or something. |
Re: using
No sure I follow. Can you help me understand how they are affected? It would seem As an aside, I wonder if an SVG icon would declare a |
I agree with Aaron, serving different manifest due to color theme seems a bit developer hostile and it won't cover all use-cases either. I might set the global theme color, say in Windows, to dark and still use my app in light mode. But this means that the shortcuts would need to use dark versions of the image resources - so it is not just always just one of the other. |
For The |
More evidence that it's not just me: whatwg/html#6408 (comment) and stars on https://crbug.com/970159. |
@marcoscaceres wrote:
I was saying that those two keys are the only color references (currently) in the manifest spec. Those are the areas that would need to be adjustable to meet the use case as the referenced
So what I am saying, in a nutshell, is that the surface we’d need to make adaptive is fairly small. In terms of how to solve this, I’m not sure, but a simple proposal might be something like: "color_schemes": {
"dark": {
"theme_color": "#fff",
"background_color": "#000"
},
"light": {
"theme_color": "#000",
"background_color": "#fff"
}
} where the Note: I would see this sitting alongside the existing @tomayac said:
Agreed. I’m not averse to offering alternative approaches, I’m just wary of forcing devs to go down a path that could eventually become a manageability problem. If we can come up with a solution that allows them to manage it in one place, I think we should. I feel the same way about translations. |
So, I definitely don't disagree: there is room for improvement as far as supporting the use cases as far as However, I think at an absolute minimum, we should aim for We might want to start by adding some more text to HTML, like:
We can then either look at fixing this issue more globally at a HTML level, or deal specifically in the manifest. |
@marcoscaceres I agree that the But I also agree with @aarongustafson that providing an own manifest per "cartesian product" option (light/dark/high contrast/… * x languages) doesn't scale well. This reminds me of what you need to do in order to specify a pixel-perfect splash screen for iOS Home Screen web apps—not very nice: <!-- iPhone X (1125px x 2436px) -->
<link rel="apple-touch-startup-image" media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3)" href="/apple-launch-1125x2436.png">
<!-- iPhone 8, 7, 6s, 6 (750px x 1334px) -->
<link rel="apple-touch-startup-image" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)" href="/apple-launch-750x1334.png">
<!-- iPhone 8 Plus, 7 Plus, 6s Plus, 6 Plus (1242px x 2208px) -->
<link rel="apple-touch-startup-image" media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3)" href="/apple-launch-1242x2208.png">
<!-- … --> Source: https://appsco.pe/developer/splash-screens We’re handling things like this in the manifest already by providing a list of icons where the user agent can pick the ones that match based on size, purpose, etc. I feel handling dark/light mode, or high contrast would also fit in there (as an additional property for @aarongustafson I'm not sure about the Long story short, I agree with @tomayac that we could have both. We should aim for |
@christianliebel wrote:
No spec changes needed in Web Manifest. But I think we should add the clarification to HTML. I'll send a PR now.
Agree. |
Sent whatwg/html#6444 to HTML. Closing as the original question was answered. Let's spin up a new bug to discuss alternative/manifest or image-resource solutions for this. |
With media queries such as prefers-color-scheme (dark or light mode) nowadays, it seems like it would be beneficial to honor the media attribute for the manifest link as raised by web developers at https://bugs.chromium.org/p/chromium/issues/detail?id=970159.
What do you folks think about it?
History shows at #186 that it wasn't an hard decision and I'd love if we could revisit this today.
CC @tomayac
The text was updated successfully, but these errors were encountered: