Re: [csswg-drafts] Review HTML fieldset/legend spec

> We should sort this out, I agree. I hope to be able to help work on this soon.

Let's talk. This is a thorny but important issue.

> No, it doesn't. Form controls are not defined to be replaced elements. See https://html.spec.whatwg.org/multipage/rendering.html#replaced-elements

They are not listed as replaced elements according to that spec, but the definition of replaced element it links to (in css2, also to be found in https://drafts.csswg.org/css-display-3/#replaced-element) to is not restrictive, so that list can easily be taken as "at least these things are", rather than "only these things can be". Throughout its usage in CSS specs, the term "replaced element" is often taken to mean "elements whose internal layout is not explained by css" in a broad sense, which would not work if it was restricted to the thigns that the html spec lists, and specs vaguely (yes, that vagueness is a problem) assume that some amount of form controls most certainly are replaced (and some partially replaced). I think this is a very messy territory.

I'll just take one example: whether listed or not, `<input type=checkbox>` effectively behaves like a replaced element, in the broad sense of the css definition: its content is outside the scope of the CSS formatting model, most properties have no effect on it, but if you apply `appearance:none` to it, then that stops being true, and it starts behaving like a regular element. So either the current definition of replaced element is not useful, or whether something is a replaced element does depend on the `appearance property` (in part. `<img>` elements  are replaced elements regardless of `appearance`).

Related note, if we take that list of replaced elements to be exhaustive, then I suppose that an svg element isn't a replaced one, and that therefore, applying `appearance: fieldtext` to it will turn it into a Block Formatting Context. I don't know what that'd mean.

> >         To turn off the magic using the appearance property, the none value is sufficient.
> Well, we also need a value that is not 'none' that fieldset has by default.

Maybe, but that value might be `auto` / `normal`, which just does the right thin on fieldsets, but doesn't let you opt into this model elsewhere. I know that whether `auto` should be a value of `appearance` is not uncontroversial, but the version without it has problems too. 

> "Otherwise , use the computed value." -- what is unclear?

I guess it depends on what "use" means. The only thing that makes sense to me is "honor the layout mode you get by obeying that computed value", but if that's true, then when `display` is `grid`, then your element must be a grid container, and must establish a grid formatting context. But the spec earlier says that it wants a block formatting context. So there's a contradiction.

Also, boxes, not elements, establish formatting contexts. In the case of `display: contents`, there's not principal box. Is `appearance: fieldset` supposed to be overriding this and make the element generate a box after all, so that it can establish a BFC? Probably not, but this is not clear.

>I dunno, fieldset is pretty funky. But if you figure something out that browsers are willing to implement, then sure.

I don't expect that we'll be able to explain the behavior of fieldset+legend in a backward compatible way with generic mechanisms. I do suspect that we may be able to obtain through generic mechanisms a behavior that is similar enough to fieldset+legend that the legacy behavior might be able to be contained to actual fieldsets+legend elements under `appearance: auto` (if that ends up being a thing), and that authors wishing to do something similar elsewhere can use the generic mechanism, rather than use the legacy compat hack that doesn't play well with the rest of CSS.  

-- 
GitHub Notification of comment by frivoal
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3094#issuecomment-420576121 using your GitHub account

Received on Wednesday, 12 September 2018 09:22:21 UTC