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

[css-gaps-1] Initial editor's draft. #10393 #11115

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

kbabbitt
Copy link
Contributor

Major changes from the unofficial draft:

  • Defer gap decoration areas out of Level 1
  • Drop the direction-relative properties
  • Generalize *-rule-break to apply to all container types
  • Remove the join keyword from *-rule-outset and fold its behavior into *-rule-break
  • Define algorithms for:
    • Determining gap decoration endpoints
    • Expanding repeaters in color/style/width properties

@alisonmaher
Copy link
Collaborator

Drop the direction-relative properties

I can't remember, was this based on feedback from the working group?

@kbabbitt
Copy link
Contributor Author

kbabbitt commented Nov 4, 2024

Formatted version of draft can be found here: https://kbabbitt.github.io/css-gap-decorations/pr-11115/Overview.html

@kbabbitt
Copy link
Contributor Author

kbabbitt commented Nov 4, 2024

Drop the direction-relative properties

I can't remember, was this based on feedback from the working group?

It was based on feedback from the issue discussion.

#10393 (comment)

  • (possibly?) add main-rule and cross-rule for Flexbox (personally I'd prefer to just use row-rule and column-rule)

#10393 (comment)

Me too. There is no main-gap or cross-gap property, so I don't think we need main-rule or cross-rule either.

Copy link

@KurtCattiSchmidt KurtCattiSchmidt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great overall, mostly just nits

<a>multicol containers</a>, <a>flex containers</a>, and <a>grid containers</a>.

<a>Gap decorations</a> do not take up space.
That is, the presence or thickness of a <a>gap decoration</a> will not alter the placement of anything else.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "thickness" the best word here? "dimensions" seems more generic. Or should you use "width" to better align with the properties defined below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For context, this paragraph was copied verbatim from https://drafts.csswg.org/css-multicol-1/#column-gaps-and-rules. But I agree with this and the next couple of suggested changes to the wording, so I'll go ahead and make them.

That is, the presence or thickness of a <a>gap decoration</a> will not alter the placement of anything else.
If a <a>gap decoration</a> is wider than its gap,
any adjacent boxes will overlap the decoration,
and in some cases the decoration may possibly extend outside the box of the container.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "possibly" seems unnecessary

and in some cases the decoration may possibly extend outside the box of the container.
<a>Gap decorations</a> are painted just above the border of the container.
For scrollable containers,
note that while the border and background of the container obviously aren't scrolled,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "obviously" seems unnecessary

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1


A <dfn>gap intersection point</dfn> exists in each of the following locations:
<ul>
<li>The center of an intersection between a gap and the content edge of the container.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should have closing </li>'s

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added throughout.

Name: column-rule-break, row-rule-break
Value: ''intersection'' | ''spanning-item'' | ''none''
Initial: ''spanning-item''
Applies to: <a>grid containers</a>, <a>flex containers</a>, <a>multicol containers</a>, and <a>masonry containers</a>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these need href's?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, Bikeshed will generate them automatically, see https://speced.github.io/bikeshed/#autolinking

<a>gap intersection points</a> which would normally determine their endpoints.
The initial value of ''50%'' places the <a>gap decoration</a> endpoint in the center of the intersection.
With a value of ''0'', the <a>gap decoration</a> endpoint will coincide with the edge of the intersection.
Negative values may be used to recede from the intersection.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this indicate direction? "...may be used to recede from the intersection in the negative direction", or is that implied with "recede"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the wording a bit to clarify. In short: a negative value moves the endpoint away from the center of the intersection.

Copy link
Collaborator

@alisonmaher alisonmaher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good to me, as well, with a few suggestions below.

Color, style, and width {#color-style-width}
============================================

Lists of values and the ''repeat()'' notation {#lists-repeat}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to move this below the definitions for column-rule-* and row-rule-* or is this the order other specs define repeat/list behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://drafts.csswg.org/css-grid-1/#grid-definition places the repeat() definition after the grid-template-* properties but before the shorthands. Changed the ordering in this spec to match.

------------------------------------------------------------------------------
<pre class='propdef'>
Name: gap-rule-paint-order
Value: row-over-column | column-over-row
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could probably use a visualization

<div class="example">
The following examples illustrate adjustment of gap decoration endpoints using the 'column-rule-outset' property.
<dl>
<dt><pre>column-rule-outset: 0px;</pre>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make sense to add 50% as an example since it's the default

At an intersection with another gap
<dd>
The <a>crossing gap width</a> is the used value of the 'column-rule-width'
or 'row-rule-width' property, whichever applies to the other gap.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what "the other gap" means here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to "the intersecting gap" - is that clearer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could also change the <dd> above to "At an intersection with a perpendicular gap" and then change this to "the perpendicular gap." (I was trying to leave room for possible future layouts that have gaps in directions other than vertical or horizontal - for example a hexagonal layout - but could set that aside for now if "perpendicular" would be clearer.)

or 'row-rule-width' property, whichever applies to the other gap.
</dl>

To <dfn>compute the offset</dfn> for a given <a>gap intersection point</a> within a given gap:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is more than one intersection point, right? Does that need to be clarified below?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, a given gap will have multiple gap intersection points - at least 2 at each edge of the container, plus 1 anywhere there's an intersection with another gap.

What I'm trying to communicate on this line is that the specific gap intersection point we're talking about is an input to the algorithm below. I'll go back through the algorithms and assign names to the inputs/given values using |...| to make this clearer.

Let |subset| be a list that initially contains only the item removed from |endpoints|.

<li>
Remove the first item from |endpoints| and add it to the end of |subset|.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Remove the first item from |endpoints|" is mentioned in the item above. Does it only need to be in one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's intentionally in both, though reading the algorithm again I realized I could make it clearer with some edits.


<pre class='propdef'>
Name: column-rule-break, row-rule-break
Value: ''intersection'' | ''spanning-item'' | ''none''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these could likely use some sort of visualization

note that while the border and background of the container obviously aren't scrolled,
the decorations need to scroll along with items in the container.

A <dfn>gap intersection point</dfn> exists in each of the following locations:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could likely use some sort of visualization since I'm struggling to understand how the first is an intersection point

<a>multicol containers</a>, <a>flex containers</a>, <a>grid containers</a>, and <a>masonry containers</a>
position child boxes adjacent to each other with gaps, also known as <a>gutters</a>, between them.
Each such gap may contain a <dfn>gap decoration</dfn> which authors
may use to provide a visual separator between adjacent boxes.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "visual separator" the right terminology if gap is defining the separation. Maybe something that notes it is used to style the gaps instead of as the separator itself?

If so, it might make sense to have a link to the definition of gap here (but maybe that wouldn't make sense since I don't think multicol has a gap property)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "visual separator" the right terminology if gap is defining the separation. Maybe something that notes it is used to style the gaps instead of as the separator itself?

Re-worded this a bit; let me know what you think.

If so, it might make sense to have a link to the definition of gap here (but maybe that wouldn't make sense since I don't think multicol has a gap property)

The "gutter" link is intended to serve this purpose - this is the term defined in css-align-3 and used in the multicol and grid specs.


<em>This section is not normative.</em>

[[CSS-MULTICOL-1#column-gaps-and-rules]] allows for rules to be drawn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we note that this will eventually be deprecated in favor of this specification?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but probably not here since this section is not normative. Added a sentence to the section with the normative property definitions.

@kbabbitt
Copy link
Contributor Author

kbabbitt commented Nov 5, 2024

@alisonmaher @KurtCattiSchmidt Thanks for the comments! I've pushed some changes with updates to the text; will work on making more visuals.

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

Successfully merging this pull request may close these issues.

3 participants