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-align-3] Baselines need to be defined on fieldsets. #7656

Open
bfgeek opened this issue Aug 29, 2022 · 6 comments
Open

[css-align-3] Baselines need to be defined on fieldsets. #7656

bfgeek opened this issue Aug 29, 2022 · 6 comments
Labels
Closed Accepted by CSSWG Resolution css-align-3 Current Work HTML Requires coordination with HTML people Needs Edits

Comments

@bfgeek
Copy link

bfgeek commented Aug 29, 2022

This will need text in the html spec - however likely can get on the same page here first as well.

https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=10640

Fieldsets likely want to determine their baselines from the "anonymous fieldset content box" https://html.spec.whatwg.org/#anonymous-fieldset-content-box

@astearns astearns added this to 3:30-4:45 in TPAC Thursday 2022 Sep 11, 2022
@astearns astearns moved this from 3:30-4:45 to 11:45-12:30 in TPAC Thursday 2022 Sep 15, 2022
@bfgeek
Copy link
Author

bfgeek commented Sep 15, 2022

@zcorpan
Copy link
Member

zcorpan commented Sep 15, 2022

Screenshot of Chrome (left), Firefox (middle), Safari (right):

Chrome: first box baseline aligns with line2, second box baseline aligns with line1. Firefox: both boxes baseline aligns with legend. Safari: first box baseline aligns with line2, second box baseline aligns with legend.

@astearns astearns moved this from 11:45-12:30 to 1:30-3:00 in TPAC Thursday 2022 Sep 15, 2022
@zcorpan
Copy link
Member

zcorpan commented Sep 15, 2022

The difference between the top box and the bottom box is the markup, "line1<br>line2" is before vs after the legend element, and also the bottom box has align-items: baseline;. I'm not sure if the first difference is intentional, or if you only wanted to test the effect of align-items: baseline;?

Per https://html.spec.whatwg.org/multipage/rendering.html#rendered-legend the placement of the legend element shouldn't make any difference; the "rendered legend" is the first child legend element (that's not floating and not position: absolute or fixed), and HTML says

If the element has a rendered legend, then that element is expected to be the first child box.

As for what which baseline to use, I think there are 3 options:

  1. Use the "rendered legend"
  2. Use the "anonymous fieldset content box"
  3. Use both

I think option (2) seems most useful, which I believe is what Chromium does.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-align-3] Baselines need to be defined on fieldsets., and agreed to the following:

  • RESOLVED: default first and last baselines to be the fieldset content's
The full IRC log of that discussion <astearns> topic: [css-align-3] Baselines need to be defined on fieldsets.
<astearns> github: https://github.com//issues/7656
<emilio> ScribeNick: emilio
<emilio> iank_: fieldsets need their baseline defined
<emilio> ... they're special, have a <legend> on the border area
<emilio> ... and their contents are wrap in a box with arbitrary display type
<iank_> https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=10714
<emilio> iank_: implementations do wild things
<emilio> ... dgrogan has screenshots of what browsers do today
<emilio> ... my preference is to ignore the legend
<emilio> ... that's Chromium's behavior
<emilio> fantasai: I'd like to argue for Safari's behavior
<emilio> ... first baseline from legend, last from content
<emilio> Rossen_: why is that more sensible?
<emilio> fantasai: legend is the first bit of text that you see
<emilio> ... seems reasonable to align to it
<emilio> ... that should def. work
<fremy> +1 for aligning fieldsets with each other based on the legend
<emilio> ... not sure what the last baseline to be, but taking the last baseline of the content of the fieldset makes sense to me
<emilio> iank_: I think I disagree, <legend> is like table captions
<emilio> ... they have smaller font-size, they're not the main content of the fieldset
<emilio> ... first baseline should be actual content, that makes more sense to me
<emilio> fantasai: would be great if web designers would weigh in on this
<emilio> Rossen_: one potential use case might be aligning multiple fieldsets
<emilio> iank_: aligning to non-fieldset content is more common I think
<emilio> dbaron: I think I lean towards agreeing with iank_
<Rossen_> ack dbaron
<emilio> ... not that uncommon for fieldsets to lack a <legend>
<miriam> +1 Ian and David
<emilio> ... if we wanted to align to legend we'd need to define what happens when there's no legend
<emilio> +1
<tantek> +1
<heycam> q+
<emilio> ... my sense is that it's common not to have one
<Rossen_> ack heycam
<emilio> iank_: if you're aligning fieldsets with and without legends it'd be weird
<emilio> heycam: agree with iank_ as well, legend is ancillary content like captions
<emilio> ... fieldset legend could also have multiple lines of text as well
<emeyer> q+
<Rossen_> ack emeyer
<emilio> emeyer: I'm looking at live dom viewer on irc
<emilio> ... I accept the argument that aligning to the legend is a bit dangerous
<emilio> ... I have the feeling that many fieldsets don't have legend
<emilio> ... but I do see situations for all three kinds of alignment. legend/first/last content
<emilio> ... if I had to pick one I'd choose first line of contents
<emilio> ... but I see use cases for the others
<emilio> ... there's cases where I might want to align to others
<emilio> ... I think both patterns would be common
<emilio> fantasai: when you want first line to align, is there case where the legends don't align?
<emilio> q+
<zcorpan> q+
<emilio> emeyer: I can't think of a reason, I'd want the legends to align with each other
<emilio> ... sometimes I want text outside to align with the legend
<emilio> iank_: if you want to align legends using top-alignment would work unless there's non-fieldset content
<emilio> emeyer: I probably would want the text outside to align with the first line of content rather than the legend
<emilio> iank_: we could also add a switch to allow you to align to a legend if that use case comes up
<emilio> fantasai: there's an issue to allow choosing baseline alignment box
<fantasai> https://github.com//issues/1339
<heycam> emilio: I was going to say something related what Ian said. we could add a switch but I'd also like to ignore the legend
<Rossen_> ack emilio
<heycam> ... if the use case for aligning to a legend comes up often, where you're aligning text outside the fieldset with the legend of the fieldset, which seems odd, we could look to allow that
<heycam> ... but seems farfetched
<heycam> ... for most cases top alignment should do
<Rossen_> ack zcorpan
<emilio> zcorpan: we discussed whether there's a case where legends wouldn't be align
<emilio> ... if you have a fieldset with one line of text and another when the legend is 2+ lines of text
<emilio> ... those wouldn't be necessarily align
<emilio> ... depending on what we decide
<emilio> ... maybe I misunderstood
<astearns> no, I had the same idea
<emilio> iank_: that's a similar problem if you try to align a fieldset with a legend and one without
<emilio> Rossen_: it sounds the obvious use case is that the first baseline of content needs to be available
<emilio> ... we need to resolve to have first-line baseline based on the content
<emilio> ... be available. The second question is whether we need to make the legend baseline available
<heycam> emilio: I would propose to try resolving the default be the baseline of the content
<heycam> ... if there are use cases that can't be solved without the baseline of the legend, work on what fantasai was talking about, choosing the baseline box
<emilio> Rossen_: seems to agree with the majority of the +1s and arguments made
<zcorpan> +1
<emilio> Rossen_: fantasai, objections?
<emilio> fantasai: defer to emeyer and jensimmons
<emilio> s/fantasai, //
<emilio> emeyer: the proposed resolution is to default to first or last baseline of the content?
<emilio> emilio: both baselines first and last would be baseline of the content box
<emilio> emeyer: feels probably correct, I'll take al look at various cases to confirm it's not a bad idea, but seems like the best resolution
<emilio> RESOLVED: default first and last baselines to be the fieldset content's

@fantasai fantasai added the HTML Requires coordination with HTML people label Jan 20, 2023
aethanyc added a commit to aethanyc/gecko-dev that referenced this issue Mar 14, 2023
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Mar 15, 2023
@hober
Copy link
Member

hober commented Oct 6, 2023

I just ran into this today. I honestly prefer WebKit's current behavior; it feels less magic, is more visually appealing, and matches authorial intent.

@Loirooriol
Copy link
Contributor

For reference, the labels in #7656 (comment) were wrong:

  • WebKit yields the middle result, not the right one
  • Gecko used to yield the right result, not the middle one, but now it yields the left one like Blink.

WebKit's current behavior may be more visually appealing just like vertical-align: top is typically more visually appealing too on inline-blocks. But when using baseline alignment, WebKit's behavior seems strange to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted by CSSWG Resolution css-align-3 Current Work HTML Requires coordination with HTML people Needs Edits
Projects
No open projects
Development

No branches or pull requests

7 participants