Skip to content

Does <legend> element establish a new BFC? #2519

@yisibl

Description

@yisibl

In HTML5 spec said:

 The `<fieldset>` element is expected to establish a new block formatting context.

https://www.w3.org/TR/html5/rendering.html#the-fieldset-and-legend-elements

What about the legend element?

Chrome and Safari will establish a BFC, see Blink code.

bool LayoutBox::AvoidsFloats() const {
  // crbug.com/460704: This should be merged with createsNewFormattingContext().
  return ShouldBeConsideredAsReplaced() || HasOverflowClip() || IsHR() ||
         IsLegend() || IsWritingModeRoot() || IsFlexItemIncludingDeprecated() ||
         Style()->GetColumnSpan() == kColumnSpanAll ||
         Style()->ContainsPaint() || Style()->ContainsLayout() ||
         Style()->Display() == EDisplay::kFlowRoot;
}

Testcase http://jsbin.com/kocubixuzu/edit?html,css,output

image

image

I think the specification should be clear, to avoid incompatibility between browsers.


Summary for this issue:

PR for the standard: #2718
web-platform-tests: web-platform-tests/wpt#6125
Browser bugs:
https://bugs.chromium.org/p/chromium/issues/detail?id=727378
https://bugzilla.mozilla.org/show_bug.cgi?id=1368723
https://bugs.webkit.org/show_bug.cgi?id=172718
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12174566/

Metadata

Metadata

Assignees

No one assigned

    Labels

    interopImplementations are not interoperable with each othertopic: rendering

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions