[csswg-drafts] [css-pseudo] ::first-letter should skip all decendant ::markers, not just the block's own ::marker (#4503)

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

== [css-pseudo] ::first-letter should skip all decendant ::markers, not just the block's own ::marker ==
[Finding the First Letter](https://drafts.csswg.org/css-pseudo-4/#application-in-css) says:
> If an element is a list item (display: list-item), the ::first-letter applies to the first letter in the principal box after the marker.

That seems to suggest that for:
```html
<!DOCTYPE HTML>
<style>
div {
  display: list-item;
  list-style-type: lower-alpha;
  margin-left: 50px;
}
#f::first-letter { font-size:400% }
</style>
<div id="f"><div>item</div></div>
```
the `::marker` for the inner `<div>` should be selected as the `::first-letter`?
Or am I simply misreading the intent of the spec here? I interpret the "an element is a list item" as being the one with the `::first-letter` style on it. If the intention is that it applies to the element itself _and all descendants too_ then I'd appreciate if that ambiguity could be removed.

Firefox, Chrome or Safari are compatible though - they select the "i" as the `::first-letter`.
 (Firefox currently doesn't support the `::first-letter` to be in a descendant block, but if I use `display:inline list-item` on the inner `<div>` instead the behavior is the same: all markers are skipped.)

Furthermore, adding `list-style-position: inside` makes no difference.  The spec says:
> User-Agents may ignore ::first-letter on list items with list-style-position: inside.

(this note seems to imply that only the top element is considered in the exemption of the marker earlier)

I think the spec should be updated to reflect reality:
1. we should skip markers of descendants too
2. remove the note about `list-style-position: inside`

IOW, all `::marker` boxes should be skipped when finding a `::first-letter`.

That reflects what UAs currently implements and that behavior makes sense. I don't really see a reason for why authors would ever want to include the marker text when searching for a `::first-letter`. If that's a use case we need to support then maybe we could add a `::marker::first-letter` selector specifically for that.

CC @Loirooriol 

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

Received on Saturday, 9 November 2019 17:17:49 UTC