-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
HTML: test inline margin on fieldset's legend #12569
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the top margin ends up affecting the position of the fieldset, but bottom margin affects the height of the fieldset?
Yeah, that's the effect of it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems weird, but if that's what implementations do...
It's what Edge does, and what I think is most useful. WebKit and Chromium ignore margin-top, which is not so useful. Gecko positions the fieldset's top border centered around the legend's margin box (as opposed to border box), which is not so visually pleasing as the legend ends up hanging inside or outside the fieldset. |
left: 0; | ||
right: 0; | ||
top: 150px; | ||
height: 220px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really behavior we want to standardize on? Looks like this test expects the legend's top margin to collapse with that of the fieldset, even though the fieldset has a border, AND both elements establish a BFC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I'd personally be okay with ignoring margin altogether (or just ignoring margin-top) as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can ignore margin in the block flow direction. @MatsPalmgren @dholbert @emilio any opinions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't find the LEGEND block margins useful at all. Since interoperability is so lousy in this regard anyway, it would be tempting to say that we just ignore them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug where margin-bottom was implemented for WebKit
https://bugs.webkit.org/show_bug.cgi?id=35981
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. There's nothing in that bug report that points out the usefulness of supporting margin-bottom on legend, though, is there? Might as well use padding-top on the fieldset, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. There's nothing in that bug report that points out the usefulness of supporting margin-bottom on legend, though, is there? Might as well use padding-top on the fieldset, right?
Seems like it -- though in Firefox, you can use margin-bottom values to move the legend outside of the fieldset's border entirely (which you can't do with padding-top, but you could achieve with relative positioning instead). That special margin-bottom behavior doesn't seem to happen in other browsers, so I'm happy to see that behavior go, anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One could use relative positioning to achieve that if desired.
Using relative positioning or padding to a simulate a legend margin seems like a hack to me. I tend to think we should support block-axis margins on the rendered legend. It's the most logical property to reach for when you want to create some distance to the surrounding content and it would be inconsistent if it doesn't work on legends when it applies to all other boxes (except inlines). Exceptions like this makes the web platform harder to understand and teach IMO. Margin properties are working fine on Also, |
It does something quite different in Firefox vs Chrome right now, FWIW. Testcase: https://jsfiddle.net/28xhe3sj/ In Firefox, the legend is way outside the fieldset border there, for reasons that @zcorpan alluded to above. Whereas in Chrome, on the other hand, it just renders as if there were extra padding at the top of the fieldset's content box.
The |
0e1a69f
to
d5c5158
Compare
d5c5158
to
6768754
Compare
@MatsPalmgren can we land this? |
@MatsPalmgren @mstensho PTAL |
I can't build the spec anymore, caused by the last commit: $ ../html-build/build.sh There were errors. Stopping. |
Oops, fixed. |
I had forgotten about this and made #13040 so now I've removed the block margin tests here. |
Can you rename the commit comment to say "inline margins", then? |
See whatwg/html#3929