w3c / w3c/csswg-drafts

[css-values] toggle() for shorthands is not forward compatible

Open
#6,764 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-values-5
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

https://drafts.csswg.org/css-values/#funcdef-toggle

If toggle() is used on a shorthand property, it sets each of its longhands to a toggle() value with arguments corresponding to what the longhand would have received had each of the original toggle() arguments been the sole value of the shorthand.

Let's consider display: toggle(block, flow-root, inline).

Right now, display is a longhand property, so we have:

  • block flow -> block flow-root
  • block flow-root -> inline flow
  • anything else -> block flow

But it seems likely that we will want to convert display into a shorthand. Then, the example will become

display-outside: toggle(block, block, inline);
display-inside: toggle(flow, flow-root, flow);

Due to short-circuiting, that's equivalent to

display-outside: block;
display-inside: toggle(flow, flow-root);

Which behaves like

  • block flow -> block flow-root
  • anything else -> block flow

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the toggle() definition in the linked CSS Values specification section and compare its shorthand-property wording with the display example in this issue. Done means the specification resolves the forward-compatibility concern and defines behavior that remains consistent if display becomes a shorthand.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.