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 Inline text-box, text-box-trim, text-box-edge #432

Closed
kojiishi opened this issue Dec 2, 2024 · 19 comments
Closed

CSS Inline text-box, text-box-trim, text-box-edge #432

kojiishi opened this issue Dec 2, 2024 · 19 comments

Comments

@kojiishi
Copy link

kojiishi commented Dec 2, 2024

WebKittens

@fantasai @nt1m

Title of the proposal

CSS Inline text-box, text-box-trim, text-box-edge

URL to the spec

https://drafts.csswg.org/css-inline-3/#leading-trim

URL to the spec's repository

No response

Issue Tracker URL

No response

Explainer URL

https://kojiishi.github.io/explainers/text-box-trim

TAG Design Review URL

w3ctag/design-reviews#1021

Mozilla standards-positions issue URL

mozilla/standards-positions#1105

WebKit Bugzilla URL

No response

Radar URL

No response

Description

To achieve optical balance of text content, the text-box-trim and text-box-edge properties, along with the text-box shorthand property, make finer control of vertical alignment of text possible.

@nt1m
Copy link
Member

nt1m commented Dec 3, 2024

I'll mark this as position: support pending objections week from now.

@Schweinepriester
Copy link
Contributor

Shipping this already is probably even better than just marking as support? :D

https://webkit.org/blog/16301/webkit-features-in-safari-18-2/

Originally called "leading trim", this feature is now simply text-box. It's a shorthand for two longhands properties--- text-box-trim and text-box-edge --- which you can declare separately if you need to control how each cascades. Safari 18.2 is the first browser to ship Text Box

👏

@argyleink
Copy link

ISSUE 12 in the spec draft says "Do not ship (yet)."?

https://drafts.csswg.org/css-inline-3/#leading-trim

@nt1m nt1m closed this as completed Dec 11, 2024
@github-project-automation github-project-automation bot moved this from Position identified to Done in Standards Positions Review Backlog Dec 11, 2024
@Schweinepriester
Copy link
Contributor

@jensimmons
Copy link

Safari shipped text-box, text-box-trim, and text-box-edge today, Dec 11, 2024.

@yisibl
Copy link

yisibl commented Dec 19, 2024

@jensimmons @fantasai I was wondering if Safari supports ideographic and ideographic-ink? I haven't seen a demo for it.

@yisibl
Copy link

yisibl commented Dec 19, 2024

@kojiishi I've noticed that it works differently in Chrome canary than Safari, can you investigate this before Ship?

https://codepen.io/jensimmons/full/gbYMERz/d04ddec1bd31a5ce3792d3bfcb34dffb

image

@bramus
Copy link

bramus commented Dec 19, 2024

@kojiishi I've noticed that it works differently in Chrome canary than Safari, can you investigate this before Ship?

Please file a bug over at https://crbug.com/ so that this is tracked. Thank you.

@nt1m
Copy link
Member

nt1m commented Dec 19, 2024

@jensimmons @fantasai I was wondering if Safari supports ideographic and ideographic-ink? I haven't seen a demo for it.

It should.

@nt1m
Copy link
Member

nt1m commented Dec 19, 2024

@kojiishi I've noticed that it works differently in Chrome canary than Safari, can you investigate this before Ship?

https://codepen.io/jensimmons/full/gbYMERz/d04ddec1bd31a5ce3792d3bfcb34dffb

This looks like a bug in Chromium fwiw.

text-box: trim-start cap seems to be computed as text-box: trim-start auto, where text-box-edge gets the wrong value (see the computed style pane).

@bramus
Copy link

bramus commented Dec 19, 2024

Thanks for chiming in everyone, I have filed https://issues.chromium.org/issues/385160696 and CC’d @yisibl and @kojiishi on the bug.

@kojiishi
Copy link
Author

@nt1m

@kojiishi I've noticed that it works differently in Chrome canary than Safari, can you investigate this before Ship?
https://codepen.io/jensimmons/full/gbYMERz/d04ddec1bd31a5ce3792d3bfcb34dffb

This looks like a bug in Chromium fwiw.

text-box: trim-start cap seems to be computed as text-box: trim-start auto, where text-box-edge gets the wrong value (see the computed style pane).

Please take a look at w3c/csswg-drafts#10703. It looks like the spec hasn't updated for this resolution. @fantasai

In this case, it has text-box-edge: cap. The cap value can't be doubled (i.e., it's not a valid value for the under side), so two values are required. Since it's missing, the text-box-edge is invalid, making it to the initial value.

@nt1m
Copy link
Member

nt1m commented Dec 20, 2024

@nt1m

@kojiishi I've noticed that it works differently in Chrome canary than Safari, can you investigate this before Ship?
https://codepen.io/jensimmons/full/gbYMERz/d04ddec1bd31a5ce3792d3bfcb34dffb

This looks like a bug in Chromium fwiw.
text-box: trim-start cap seems to be computed as text-box: trim-start auto, where text-box-edge gets the wrong value (see the computed style pane).

Please take a look at w3c/csswg-drafts#10703. It looks like the spec hasn't updated for this resolution. @fantasai

In this case, it has text-box-edge: cap. The cap value can't be doubled (i.e., it's not a valid value for the under side), so two values are required. Since it's missing, the text-box-edge is invalid, making it to the initial value.

@kojiishi It's possible WebKit needs to update for this resolution, but in that case, I think Chromium still has a bug with the shorthand:

text-box: trim-start cap; still successfully parses in Chromium, with text-box-trim being successfully applied to trim-start, despite the text-box-edge value being incorrect. If the text-box-edge value is incorrect, it should invalidate the whole shorthand, and text-box: trim-start cap should not do anything (not even apply text-box-trim: trim-start).

@fantasai
Copy link

@kojiishi I am pretty sure I updated the spec? https://www.w3.org/TR/css-inline-3/#text-edges

That said, text-box: trim-start cap is a very reasonable thing to write and we might want to make it valid, at least in the shorthand if not in both places.

@fantasai
Copy link

fantasai commented Dec 20, 2024

@argyleink Yeah, we needed to resolve some issues around fragmentation, inheritance, etc. that were still up in the air. But with @kojiishi's help we got through those issues, and I just finally updated the spec.

@jensimmons
Copy link

jensimmons commented Dec 20, 2024

I've been building demos of text-box for the last couple weeks, and have come to the conclusion that requiring authors to define both edges in the shorthand is a mistake. These should work:

  • text-box: trim-start cap
  • text-box: trim-start ex
  • text-box: trim-end alphabetic

I'll file an issue at the CSSWG about this, but meanwhile I do not believe browsers should implement these rules as invalid.

@nt1m
Copy link
Member

nt1m commented Dec 20, 2024

I'm not sure how I feel about making the shorthand parsing different from the longhand parsing. I'd rather have those 2 be identical. I don't really have a strong opinion whether to require two values though.

@kojiishi
Copy link
Author

kojiishi commented Jan 7, 2025

Whether to require two values or not is due to the lack of consensus at w3c/csswg-drafts#10703. Both sides have reasonable points and supporters that it wasn't easy to reach a consensus.

I think we can get more feedback and stats when developers started using this feature, which can help us to reach a consensus. Until then, I think more restrictive implementation is safe, as whichever change won't break existing sites.

@jensimmons
Copy link

I wrote up the issue today at w3c/csswg-drafts#11460

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

No branches or pull requests

8 participants