Re: HTML <fieldset> rendering

16.01.2014, 07:10, "Robert O'Callahan" <robert@ocallahan.org>:
> The rendering of fieldsets is under-specified at the moment, even taking into account http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#the-fieldset-and-legend-elements.
> [...]
> I'm not sure what to do.

Main issue with form-related elements is that CSS currently does not provide an explicit formal way to switch an element between OS-native and regular-CSS-element rendering modes.

That's not about just FIELSET/LEGEND elements, but also about any form elements like button. That's a fundamental CSS issue.

Probably a good long-term solution for FIELSET/LEGEND rendering would be following:

1. default FIELSET's and LEGEND's `display`-property value is `native`, and FIELSET/LEGEND are rendered OS-native way;

2. if FIELSET has any `display` value different from `native`, then the FIELSET and its LEGEND are rendered as regular (like DIV) elements, without any special styling;

3. if LEGEND only (with FIELDSET's default styles untouched) has any `display` value different from `native`, then the LEGEND only is rendered as regular (like DIV) element (without any special styling): entirely inside FIELDSET, without any implicit styling like top offset of half-line height.

"Regular element" here stands for an element completely unstyled by default like DIV.

Having a dedicated property value like `display: native` for all form-related elements would also allow web developers to switch an element _back_ from styled state to its original native rendering (that in fact is currently impossible at all) -- maybe in conjunction with `all: unset`.

As a much less universal alternative, a "quickfix" for FIELSET/LEGEND themselves could be to make them implicitly become regular elements if _any_ of CSS properties are set for FIELDSET or for any of its descendants.

Explicit way to control element's native/nonnative styling (e.g. via the dedicated `display: native` property) looks much better from long-term perspective than an implicit/quirky one like we already have currently (that has lead this thread to appear in the first place) or like the quickfix for FIELSET/LEGEND only.

Of course, changing things now would affect backward compatibility to some extent, but continuing to live with current quirky uncertainty as for rendering form-related elements (incl. [but not limited to] FIELSET/LEGEND) would probably be even worse.

Thanks.

Received on Thursday, 16 January 2014 17:31:03 UTC