[csswg-drafts] [css-pseudo][css-tables-3] Should the first line of a caption be the first line of ancestors?

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-pseudo][css-tables-3] Should the first line of a caption be the first line of ancestors? ==
The ::first-line of a block container is supposed to be nested inside the innermost enclosing block box.

[CSS Pseudo](https://drafts.csswg.org/css-pseudo-4/#first-text-line) only excludes

> The first line of a table-cell or inline-block cannot be the first formatted line of an ancestor element.

presumably because in CSS 2.1 these were the only block containers that do not participate in a BFC. (Now that we have others, like flex items and grid items, I think the spec should be generalized, see #1174)

But there is another interesting kind of block container: table-caption. The table caption is inside the table wrapper box, which according to [CSS 2.1](https://www.w3.org/TR/CSS21/tables.html#model) and [CSS Tables 3](https://drafts.csswg.org/css-tables-3/#ref-for-table-wrapper-box-1),

> The table wrapper box establishes a block formatting context.

So table-caption is in fact a block container which participates in a BFC, and thus it seems reasonable that CSS 2.1 did not exclude table-caption for ::first-line propagation.

However, the two implementations which nest ::first-line inside inner blocks (Chrome and Edge) do not do this for table-caption.

Consider this example: https://jsfiddle.net/Lwf9h6Lm/

```css
div::first-line { color: red }
span { display: table-caption; color: green }
```
```html
<div><span>Foo</span></div>
```

Foo is green on both Chrome and Edge, unaffected by div::first-line.

In fact I think a table wrapper box should establish a table formatting context, and thus the table-caption would participate in that TFC instead of in a BFC (see #1189). Then Foo would be expected to be green.

But if table-caption remains block-level, what should happen with ::first-line? Should browsers change in order to make Foo be red, or should table-caption be added as an exception for ::first-line, to let Foo remain green? And if div::first-line is expected to be nested inside the table-caption, should this still be the case with caption-side:bottom?

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1192 using your GitHub account

Received on Sunday, 9 April 2017 18:48:24 UTC