Open heycam opened 6 years ago
Though this would be a unique (strange) distinction between borders and outlines, I agree with @heycam, since tbody
is also allowed outline
styles. Whereas tbody
cannot have its own border
styles if borders are separate, making the border
set on table
useful around its table grid.
This fits in the the broader question of how much we should define outlines in general. In the past, the answer has been that we should hardly define them at all. The logic for that being that outlines is mostly a UI feature and UI is an areas where browsers should be free to innovate.
I'd be in favor of gradually tightening it up and trying to converge onto something, but it's a broad topic, there are many points of divergence. If there's a will on the implementer side to try and reach for interop, i'm happy to give it a go, but this has not always been the case.
Much of this issue stems from very poor HTML standards: label, caption and figcaption have very differing constructs for essentially the same purpose.
In my view an outline should always outline the whole of an element, not just part of it. A caption is within a table element so should be included within the outline of a table.
I note that if a listener is added to a table element, the whole area of the element becomes responsive, including the caption (Chrome, Firefox, Edge & IE11 at least).
A workaround for differing browser behaviour is to put a table within a figure element and use figcaption instead of caption. As figure and figcaption have much more sensible HTML coding and semantics, in my view use of caption and label should therefore become deprecated in favour of use of figcaption within a figure.
The CSS Working Group just discussed Defining Outline
.
Quick note that the table spec is specific about this, so it wasn't clear to me today's discussion was addressing this particular issue, that seems to be about changing what we define and is implemented by two user agents.
A workaround for differing browser behaviour is to put a table within a figure element and use figcaption instead of caption. As figure and figcaption have much more sensible HTML coding and semantics, in my view use of caption and label should therefore become deprecated in favour of use of figcaption within a figure.
Unless that <figure>
is styled with display:table
where it becomes the exact same scenario to captions inside tables 😅
CKEditor 5 (but I know that not only we went this way – it's also used e.g. by Drupal) use display:table
on <figure>
to make it take the image's width. Unfortunately, with those styles we hit Firefox's issue: https://github.com/ckeditor/ckeditor5/issues/1979.
I'd note (based on bug 1603049) that specifying the Gecko behavior here would require extending the list of properties used on the table wrapper box (currently "The computed values of properties 'position', 'float', 'margin-*', 'top', 'right', 'bottom', and 'left' on the table element are used on the table wrapper box and not the table box") to include both outline
(the shorthand) and outline-offset
.
https://drafts.csswg.org/css-ui-3/#outline-props https://drafts.csswg.org/css-tables-3/#drawing-table-backgrounds-and-borders
See this test:
https://bug1482778.bmoattachments.org/attachment.cgi?id=9012757
In Firefox and Edge, the outline surrounds the main table grid. In Chrome and Safari, the outline also includes the caption. The not-ready-for-implementation css-tables-3 says that backgrounds, borders, and outlines that would be positioned relative to the border-box of the table are adjusted to be relative to the table grid and its border spacings.
I think drawing an outline around the table including the caption would be a little more useful.