Closed Bug 276456 Opened 20 years ago Closed 16 years ago

[MARGIN-C] Margin collapsing doesn't work for fieldset / legend

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: MatsPalmgren_bugz, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(4 files)

Margin collapsing doesn't work for fieldset / legend.
Attached file Testcase
Fieldset is a block formatting context root in Mozilla.  For example, a float in
a fieldset will affect the size of the fieldset.  David (last I checked) and I
both believe this to be reasonable behavior for fieldset.

In Opera, a fieldset seems to behave like a non-formatting-context-root block.

So it seems that the behavior of both is "correct" given the issue with the
fieldset/legend combination being describably via CSS...
Attached file Testcase #2
Attached file Testcase #3
(In reply to comment #3)
> Fieldset is a block formatting context root in Mozilla. 

Ok, but the description of block formatting context does not say how margins
collapse of the box itself, only that margins inside it collapse.
http://www.w3.org/TR/CSS21/visuren.html#block-formatting

and the description of collapsing margins:
http://www.w3.org/TR/CSS21/box.html#collapsing-margins
does not mention block formatting contexts at all. It does mention exceptions
for float, abs.pos. etc which happens to be all of the block formatting
contexts that have vertical margins, but fieldset is not one of those, is it?

So, as far as I can see, how block formatting contexts "in general" should
collapse at its margin edge is not defined (except for those explicitly
mentioned). (is it compliant with the spec to have block formatting
contexts other than those mentioned in 9.4.1 "Block formatting contexts"?)

Don't get me wrong, I think it makes sense to make fieldset "block formatting
context"-ish, but the margins are not handled quite right IMO.

The problem, I think, is that FieldSet::Reflow needs to pickup the collapsed
top margin and the carried out bottom margin on the inner content frame and
do something with it. Question is what?

For me, it makes sense to have normal margin collapsing behaviour between
the legend and the elements that follow (top of inner content frame) and the
carried out bottom margin from the content frame should be "carried out"
from the fieldset when it has no border etc, or FieldsetFrame::Reflow should
make room for it. I don't have a strong opinion though, blocking the margins
is fine too.

Comments?
I was under the impression that the collapsing margins section hadn't been
updated to explicitly talk about block formatting context roots simply because
it had been written before that concept was introduced...

I'll send mail to www-style to clarify this point.
Blocks: 294803
Blocks: 329359
I seem to recall that hixie claimed this was valid, though I don't have the reference offhand.  In any case, the problem is that we use a single bit to determine whether to collapse with both kids and siblings.  We'd need to change that.
I don't really recall what the conclusion was with <fieldset>. I kinda suggest waiting until there's a spec that covers the rendering of form controls in terms of CSS, but then again, we might be waiting a while.
As of today, HTML 5 defines that the fieldset element establishes a new block formatting context, see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#the-fieldset-element-0

This is in line with current browser versions.

Our implementation matches the current state of CSS 2.1 (including the errata). Tests for this will eventually land with bug 477462.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: