There are currently two kinds of "text" icon in cursor at ui-4 draft: text and vertical-text .
For text, the spec says the UA can either always render the cursor as in horizontal writing mode, or render it based on the writing-mode value. IMO, this has two issues:
This is logical asymmetry. Why can text be specially treated as always for horizontal writing mode as an alternative, why can't it be treated as always for vertical writing mode?
Also this is problematic if the designer really wants the cursor to depend on the writing mode, because according to the spec, the behaviour of the text doesn't garantee the cursor is writing-mode dependent.
I suggest we change the text to be always writing-mode dependent, and add a new value horizontal-text to cursor. I don't think there are compatibility problems in the real world, as the writing mode isn't widely used for now. The earlier we change it, the smaller the problem it would cause.
Those sorts of "can be A or B" spec texts usually mean that, at the time the spec was written, browsers had both of those behaviors, and there wasn't a clear preference for everyone to shift one way or the other. If this has shifted, and browsers now agree on a behavior, we can easily change!
That said, while this spec text is weird, there's not a strong benefit in doing anything here, as the current values do suffice for authors. If you just set text on any with a horizontal writing mode, and vertical-text on anything with a vertical writing mode, you're guaranteed to get the correct cursor at all times. In some browsers the vertical-text isn't required, as text would work correctly, but nobody is hurt by applying vertical-text to vertical text.
(You can't reliably apply a horizontal-text bar to vertical text with the existing values, but that's really weird to do, so it's not an important lack to solve.)
If you just set text on any with a horizontal writing mode, and vertical-text on anything with a vertical writing mode, you're guaranteed to get the correct cursor at all times
Thanks for the reply.
What you said is applicable in pure CSS method when you already know the writing mode of the parent of the target element beforehand.
But please consider there are cases when the developer wants to write a reusable widget which can be used in senarios where the writing mode is unknown beforehand. And That was what I encountered before I posted this issue. So, the method isn't applicable. I do think it's necessary to resolve it.
For that case, should we just put pressure on UAs to make text always match the writing mode (I.E. by making it a must in level 4), and then deprecating vertical-text, since there would be no use left for it?
I second @frivoal
Agenda+ to propose changing from may to must about cursor: text displaying a rotated cursor for vertical text.
I agree, automatic alignment (with must) is preferable
What about elements with selectable text (either horizontal or vertical) rotated by 90deg via transform for some design/presentation purposes? Isn't it a possible use case for applying a text cursor perpendicular to the actual text direction to such elements?
yes, maybe we should also consider frantsform.
And further, transform for any angles other than a right angle might need to be considered too.
IMHO, I suggest the spec recommend UAs to render a horizontal or vertical text cursor, depending on which one has a angle less than 45 degree with the current character. If both the two kinds of the cursor have equally 45 degree with the current character, it's okay to choose either one.
What about stacked vertical text? The characters are horizontal but the line is vertical.
The CSS Working Group just discussed Add value `horizontal-text` to property `cursor`.
The full IRC log of that discussion
<dael> Topic: Add value horizontal-text to property cursor
<dael> github: github: https://github.com/w3c/csswg-drafts/issues/3196#issuecomment-427739133
<dael> github: https://github.com/w3c/csswg-drafts/issues/3196#issuecomment-427739133
<dael> florian: Conversation has evolved. THe property has 2 values about text: text and vertical-text. text is a vertical I beam that usually shows like it's horizontal, but the browser may show vertical at vertical and may do angles. That we have one must on vertical but a may on text it's a problem.
<dael> florian: Suggestion is change the may to a must. If it's over vertical you must match. Diagonal I think stays as a should.
<dael> florian: If we get that for text we can deprecate vertical-text
<dael> dbaron: State of implementations switching to vertical?
<dael> florian: I don't remember. At least one impl does it, but I don't remember if more than one
<dael> astearns: I'd be more happy to resolve if we have an impl report
<dael> astearns: If this is something we'd have to wait on bugs or if this is uncontroversial
<dael> florian: It is not something everyone impl.
<dael> florian: I think I have the list, but I'd have to find it.
<dael> myles: Webkit does rotate
<heycam> Gecko also does
<dael> dbaron: I can tell you Gecko has code that does it, though I haven't made sure it works
<dael> florian: Test harness is tto slow to pull results
<dael> dbaron: It's possible we only work for auto
<dael> fantasai: Works for text.
<dael> myles: Chrome, FF and Webkit all rotate
<dael> florian: So shouldn't have too many problems with must
<dbaron> I'd note the test should test behavior both with 'cursor: auto' and with 'cursor: text'
<dael> florian: I will not current phrasing does not care if the text is vertical due to a specific reason. not sure we've tested all those variants
<dbaron> and the Gecko code only looks at writing mode
<dael> astearns: Suggestion is change the wording that it's must when writing mode gives you vertical?
<fantasai> Gecko doesn't look at transforms
<dael> florian: At least writin modes. If we can do any reason it's nice. Angled cursor except 0 or 90 deg should be a should
<dael> florian: For 90deg transforms what do people think?
<fantasai> Neither does Chrome
<dael> gregwhitworth: WIth transforms we don't change ours. I would struggle to feel that is a high priority for webdevs. For vertical it makes sense. I think that's where I would start and then try and find a common pattern
<dael> florian: So must on writing mode, should on transforms
<dael> fantasai: Yeah
<dael> myles: If no impl I'm not sure it should be a should
<dael> florian: Keep as a may?
<dael> gregwhitworth: May sounds right. Majority of webdevs aren't using text you'd want copy/paste at odd angles. I'd put may. If someone wants that step sure.
<dael> florian: So that's unchanged, make it a must for vertical writing modes
<dael> astearns: Prop: Change cursor in vertical writing mode to a must
<dael> astearns: Obj?
<dael> resolved: Change cursor in vertical writing mode to a must
Most helpful comment
For that case, should we just put pressure on UAs to make
textalways match the writing mode (I.E. by making it a must in level 4), and then deprecatingvertical-text, since there would be no use left for it?