Skip to content
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

What's the right way to support mobile screens in the UA stylesheet? #8224

Open
mfreed7 opened this issue Aug 26, 2022 · 4 comments
Open

What's the right way to support mobile screens in the UA stylesheet? #8224

mfreed7 opened this issue Aug 26, 2022 · 4 comments

Comments

@mfreed7
Copy link
Contributor

mfreed7 commented Aug 26, 2022

For some historical context, see #624 which is about a media query that used to be in the spec for the <dialog> element. The original purpose was to support mobile screens by "going full-screen" for dialogs on small screen devices.

This issue will be coming back as we work to introduce the <selectmenu> element. On most browsers, the existing <select> element goes into a full-screen, mobile-specific mode on small screen devices. This is intuitive and generally helpful for users - it makes selecting an option less tedious on these devices. Since the <selectmenu> element is fully-developer stylable, we would expect developers to do something similar. But we'd also like to have good default (interoperable, standardized) styles for the <selectmenu> element. For that purpose, it would seem (to me at least) to make sense to have a screen size media query included in the default styles, which renders the dropdown list in something like a full-screen mode.

Since it sounds like the only precedent for this type of UA stylesheet addition was the old <dialog> rule, I thought it'd be good to discuss the right way to approach this.

@dandclark @domenic @zcorpan @foolip @Hixie @annevk

@sefeng211
Copy link
Contributor

sefeng211 commented Aug 29, 2022

@emilio Emilio, do you have thoughts about this since in the past we had tried to done something similar for <dialog>?

@zcorpan
Copy link
Member

zcorpan commented Sep 1, 2022

Mobileness is exposed in navigator.userAgentData.mobile: https://wicg.github.io/ua-client-hints/#getters

Would it be appropriate to switch from "mobileness" to instead use pointer: coarse media query for <select> and <selectmenu>?

Also see #8189

@mfreed7
Copy link
Contributor Author

mfreed7 commented Sep 2, 2022

Mobileness is exposed in navigator.userAgentData.mobile: https://wicg.github.io/ua-client-hints/#getters

Right, but that's not exposed as a media query, right? Perhaps the best solution would be to expose mobileness in a media query? I'm sure there's some context for why that's not already there, but I don't know what it is.

Would it be appropriate to switch from "mobileness" to instead use pointer: coarse media query for <select> and <selectmenu>?

The problem with that is that it'll match for tablets, and the real context for the question is "small screens". On a tablet, current behavior (in my quick testing) for <select> is to show the same view as desktop.

Edit: after thinking about it for a second, perhaps the context really is "coarse pointers". I.e. the point of the special screen on mobile is that it's hard to pick small options with your finger. Existing browser behavior is to only do that on small screens, but perhaps the discussion really should be about the pointer type? I just know that people (me) get annoyed when a desktop site does something different on a tablet screen, and this may be one of those things.

Also see #8189

Interesting issue! I did not know we had some hack to allow <hr> inside select, that pains me.

@zcorpan
Copy link
Member

zcorpan commented Sep 5, 2022

Right, but that's not exposed as a media query, right?

Indeed. It could be; filed w3c/csswg-drafts#7696.

The problem with that is that it'll match for tablets, and the real context for the question is "small screens". On a tablet, current behavior (in my quick testing) for <select> is to show the same view as desktop.

I tested Safari on iPad and Chrome on Galaxy Tab with BrowserStack, and it's not quite the same as desktop but also not the same as mobile.

select multiple is in an element-anchored popup instead of a screen-anchored popup in Safari. select is a dropdown in tablet Chrome but a screen-anchored popup on mobile, but select multiple has the same behavior in mobile Chrome as tablet Chrome.

Screenshot of select multiple on Safari on iPad, showing a popup anchored to the element.

Screenshot of select on Safari on iPad, showing a dropdown.

Screenshot of select multiple on Chrome on Galaxy Tab, showing a modal popup centered on the screen.

Screenshot select on Chrome on Galaxy Tab, showing a dropdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants