-
Notifications
You must be signed in to change notification settings - Fork 657
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
[css-mediaqueries-5] nav-controls future proofing concerns (should each control have its own feature?) #6785
Comments
"none" is covered by Sebastian |
That is indeed possible: any of an MQs values might be true or false, with no exclusivity implied. @SebastianZ's comment correctly explains how to combine those to get the precise boolean conditions, if desired. |
Fantastic, I did not realise MQs were essentially a bag of Booleans, as opposed to an enum. Re-reading the text of that green box, I now understand what it means. But I had a totally different read of it. I think the last sentence is somewhat misleading:
I thought you were advising people to use I think this is probably bad advice. Regardless of whether the new features will generally come with a back button, I would therefore propose two non-normative changes:
Reopening for discussion. |
Uploaded PR #6795 enacting the above proposal. |
Follow-up to #4187 (adding
nav-controls
media feature).Draft spec text: https://drafts.csswg.org/mediaqueries-5/#nav-controls
This feature seems to work when the only queryable feature is
"back"
, but I don't see how this can be expanded in the future to support querying new features. As an example, in #4187 @grorg suggested a future ability to query for a user-agent-supplied Share button.With only two values,
none
andback
, we can clearly distinguish between these two cases. But say we addedshare
; how would we distinguish the four cases of "none", "back only", "share only" and "back and share"? I don't believe MQ features can have multiple values (i.e. it's not possible for the UA to setnav-controls
to {back
,share
}, and have the queries@media (nav-controls: back)
or@media (nav-controls: share)
both succeed). So, how would we ever add a new queryable control?(Please forgive my ignorance if this is actually possible, in which case this issue can be closed.)
This is touched on by a green box in the spec text, but I don't think the answer is entirely satisfying:
This is basically saying if we add a new control, say,
share
, then:back
would mean "back only"share
would mean "back and share"There are two problems with this:
@media (nav-controls: back)
. Adding a new control likeshare
will immediately break any sites which are (against the advice of the green box) using this query.forward
, and assume a back button is always present if there are any controls at all. How will user agents communicate to sites the difference between "back and share", "back and forward" and "back, forward and share"?Since the intended usage of this is to consider each control in isolation (e.g. hide the in-page back button if the UA provides one, hide the in-page share button if the UA provides one, etc), why not simply provide a separate media feature for each control, with a common prefix?
This implies that instead of
nav-controls
:none
|back
, we should havenav-controls-back
:<mq-boolean>
. Any new controls would get their own feature, e.g.nav-controls-share
:<mq-boolean>
.Thus the usage changes to
which is easier to read than
@media (nav-controls)
because it's explicit about the fact that we're looking for a back button (noting that@media (nav-controls: back)
in the current draft is also explicit, but wrong).The text was updated successfully, but these errors were encountered: