Closed jfkthame closed 6 years ago
Previous discussion of tab-size: 0
was in #460. (It may be that the web compat issues mean we should revisit that.)
Previous discussion of tab-size: 0 was in #460
This isn't about whether the tab-size property should be allowed to be zero, but whether individual tabs should be allowed to shrink to almost-zero if the current position happens to be very close to a tab stop, or should a minimum visual separation be maintained.
(See the testcase, where tab-size is left at its initial value.)
@jfkthame's observation is correct--when we've got a bug saying Gecko renders a tab but it's invisible in Blink (crbug/635717), I chose to use half-a-space-width.
I agree that defining the minimum tab width is good for better interoperability. On the other hand, no matter what we define the minimum tab width, matching tab positions seems hard. Any ideas to solve or mitigate this?
setting the minimum to one space would be ideal, as it would do "the right thing" in the monospaced case, and would do something close for non mono-spaced fonts.
However, there often are little approximations when rounding, meaning exactly 1 space might cause accidental pushing to the next tab stop, so maybe we should use something slightly smaller than a space. However, I think Koji's suggestion of half a space is too small. Visually, that's really narrow, and rounding approximations aside, I don't think people who use a tab want a gap that's much smaller than a space.
Maybe 3/4 of a space ?
sorry, I misread. In a proportional font, 0.5ch
is much broader than 0.5 space characters, which is what I thought you were talking about, and it will still do the right thing in a monospace font. I support that as a minimum.
Agenda+ to:
0.5ch
The CSS Working Group just discussed Applying a min width to rendered tabs
.
Closed by f4ad04f50e282d2cfff60c2fd5ceeb62d786af4f
Testcase: https://jfkthame.github.io/test/tab-min-width.html
Relevant spec text from https://drafts.csswg.org/css-text/#white-space-phase-2, step 2:
This implies that if the current position in the line, when a tab is encountered, is just slightly short of a tab stop -- say, 1px before it, or even 0.1px before it -- the start of the next glyph will be lined up with that tab stop, resulting in an extremely narrow width for the tab.
The testcase shows that Webkit and Blink enforce a minimum advance for the tab, so that if the distance to the next tab stop is less than 0.5ch, they will actually skip that tab stop and move to the next. So the column of "foo"s in the testcase jumps over as soon as the width of the initial span exceeds 7.5ch.
Firefox and Edge, on the other hand, do not enforce any minimum width for the tab, and so the "foo"s don't jump to the right until the span width reaches 8ch.
The Firefox/Edge behavior seems correct per spec; there's nothing in there about skipping a tab stop position if we're within 0.5ch (or any other small-but-nonzero distance) of it. However, I think a reasonable case could be made for the Webkit/Blink behavior.
The current discrepancy can result in real-world webcompat issues, as seen for example in https://github.com/webcompat/web-bugs/issues/17530. Should we file bugs against Blink and Webkit and ask them to change behavior to strictly follow the current spec, or should we amend the spec to match their behavior (and ask Gecko and Edge to change accordingly)?