Closed astearns closed 6 years ago
I agree that the initial-letter's vertical position should not account for the floats. I think that's what the spec currently specifies, since it doesn't say otherwise, and doesn't define the initial letter as a float. (Though it could be moved down for floats if it actually doesn't fit next to them.)
The horizontal position, on the other hand, does definitely need to account for floats, and does, since the initial letter is placed horizontally relative to the line, which is affected by floats... at least modulo issues like #689.
Then there's the question of how the position of floats needs to account for the initial letter (the opposite direction of interaction from my previous two paragraphs), which is what the section currently covers. It could perhaps be retitled to make it clearer that it covers how floats move in response to initial letter, and not how initial letter moves in response to floats (which I believe is fully defined elsewhere).
I believe floats whose placeholder/anchor is in a line after the first line of the block with initial-letter but one that does intersect the initial letter do need to be pushed down vertically past floats. Otherwise you'd have to find a way to address the circularity of placing a float in a way that would need to shorten a prior line (assuming a sensible fix for #689). I think the short text currently in the spec came out of a rather long working group discussion we had on this topic some time ago, although I'm not completely convinced it does so adequately (e.g., for opposite-side floats), but I haven't considered this closely.
As the issue currently in the section notes, it's less clear whether we want that behavior for a float whose placeholder/anchor is in the first line of the block with initial-letter, since in that case it is entirely possible to displace the initial letter. (But is it desirable?)
/cc @chenpighead
If there's a float in the first line, ideally the float would be placed first, then the initial letter:
A major goal is to avoid a float coming between the initial letter and the subsequent line:
As written, if there's a float on the first line I think we get this:
But what if the float is anchored in the second line? Do you want it to push the initial letter in (like your first picture above, but a line lower), or do you want the float to get pushed down to the third line (like your third picture above). My gut feeling is for the latter (pushing down).
I agree that pushing down would be best. The other alternatives are weird. If both the initial letter and the float are treated as ordinary floats, you get
If you place the float, and then the initial letter, it's maybe even worse:
So I think the pushed-down version is best:
Link to F2F discussion: https://lists.w3.org/Archives/Public/www-style/2017Feb/0050.html
OK, @dauwhe and I made edits based on the WG’s F2F discussion in Seattle. Flagging Agenda+ for formal review, and because the various points (below) weren't formally resolved during that meeting. The conclusions of the Seattle discussion were:
The Working Group just discussed Interaction with Floats
, and agreed to the following:
RESOLVED: clear doesn't apply to initial letters
RESOLVED: Initial letters must not overlap floats (just like lineboxes don't).
RESOLVED: If a linebox moves down or is shortened due to a float, initial letter moves with it, and vice versa.
RESOLVED: An inline-start float originating on first line can go between initial letter and containing block edge. (It can't split the initial letter and the subsequent text.)
RESOLVED: An inline-start float origining on subsequent impacted lines must clear the initial letter.
https://drafts.csswg.org/css-inline/#initial-letter-floats needs more details.
One user of the dropcap.js polyfill has run into a problem where the float simulation of a dropcap interacts badly with multiple same-side floats:
https://github.com/adobe-webplatform/dropcap.js/issues/21
It would be good if we could define initial-letter in such a way that the floated widgets laid out as if the initial-letter did not exist, and the initial-letter would be placed at the top of the in-flow content without reference to the floats or any float clearing.