Skip to content

[css-text-4][css-flex][css-grid] 'auto' value needed for text-space-trim to cover white space discarding between flex and grid items? #3124

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

Closed
SebastianZ opened this issue Sep 18, 2018 · 7 comments

Comments

@SebastianZ
Copy link
Contributor

SebastianZ commented Sep 18, 2018

If the child text between flex and grid items only consists of white space, it is not rendered.

This is as if text-space-trim was set to discard-before discard-after for those items. Though the default value of text-space-trim is none, which contradicts the whitespace discarding logic in flex and grid layout.

Therefore I think an auto value needs to be introduced for text-space-trim and be made the initial value.

The computed value may then still be auto, or be either none or discard-before discard-after depending on the layout type.

Sebastian

@fantasai
Copy link
Collaborator

Why do you want this white space to appear?

@SebastianZ
Copy link
Contributor Author

I don't want this white space to appear but to explain why there is no white space. And this explanation can happen via text-space-trim.

Sebastian

@SebastianZ
Copy link
Contributor Author

Well, the question you probably actually wanted to ask is, why should text-space-trim influence flex and grid items? The answer is, for consistency. And it's currently already defined to apply to "all elements", so also to flex and grid items.

And there may even be use cases for having white space between flex items, like for the text in https://jsfiddle.net/SebastianZ/Lvds0wpj/.

Sebastian

@fantasai
Copy link
Collaborator

If there's no use case, then there's no need to add the feature. Adding feature is work not just for the spec editors, but also for implementers and testers. And it also increases the knowledge overhead for authors and educators. We do not add features just because it sounds nice, we add them because they're useful.

If all you need is an explanation, then it's this: text runs consisting of white space are always discarded except when occurring as inline-level content. We don't need a property to exist to “explain” why this happens.

@SebastianZ
Copy link
Contributor Author

We do not add features just because it sounds nice, we add them because they're useful.

I didn't say to add it because it "sounds nice" but to make text-space-trim conform to the following statement in CSS Flexbox and CSS Grids:

However, if the entire sequence of child text runs contains only white space (i.e. characters that can be affected by the white-space property) it is instead not rendered (just as if its text nodes were display:none).

While the definition of text-space-trim says it applies to all elements, according to the above sentence it does not seem to apply to flex and grid items, right?

text runs consisting of white space are always discarded except when occurring as inline-level content.

Can you point me to the spec. where this is defined, please? (The citation above only specifies the discarding of white space for flex and grid items, but I coun't find this general definition yet.)

Sebastian

@fantasai
Copy link
Collaborator

fantasai commented Oct 2, 2018

While the definition of text-space-trim says it applies to all elements, according to the above sentence it does not seem to apply to flex and grid items, right?

Updating the Applies to line to be more precise makes a lot more sense than adding a new feature that has no use case, though?

Can you point me to the spec. where this is defined, please? (The citation above only specifies the discarding of white space for flex and grid items, but I coun't find this general definition yet.)

There's no general statement anywhere afaik, since white space discarding is defined per layout mode, but it is true.

@SebastianZ
Copy link
Contributor Author

While the definition of text-space-trim says it applies to all elements, according to the above sentence it does not seem to apply to flex and grid items, right?

Updating the Applies to line to be more precise makes a lot more sense than adding a new feature that has no use case, though?

Yep.

Can you point me to the spec. where this is defined, please? (The citation above only specifies the discarding of white space for flex and grid items, but I coun't find this general definition yet.)

There's no general statement anywhere afaik, since white space discarding is defined per layout mode, but it is true.

Especially, I couldn't find the one that says that this applies to block-level elements. I guess it would be easier to maintain and reference if the statement was centralized somewhere instead of duplicating it for every layout mode.

Sebastian

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

No branches or pull requests

2 participants