Re: [css4-ui] Styling the caret

On Fri, Aug 15, 2014 at 2:16 PM, Edward O'Connor <eoconnor@apple.com> wrote:
> Lea wrote, in 2011:
>> Something like:
>>
>> Name: caret
>> Value: auto | <color> | invert
> […]
>> Implementors, would this be possible?
>
> Secondly, some RTE developers will want the caret to have a particular
> color throughout the editing area. In the current proposal they can do
> this by setting caret to an explicit <color>:
>
> [contenteditable] {
>   background: white;
>   color: black;
>   caret: #639;
> }
>
> But what if they want to set the caret color to be the same as the
> foreground color of the editable area, whatever that may be? You might
> think that they can use the 'auto' keyword:
>
> [contenteditable] {
>   background: white;
>   color: black;
>   caret: auto;
> }
>
> But consider this case (where the | represents the caret):
>
> <div contenteditable>
> …<p style=color:red>this paragraph | is red</p>…
> </div>
>
> If the RTE developer uses the 'auto' keyword, the caret will be red,
> when they intended it to be black. (The p inherits caret: auto, and auto
> means currentColor, so it's the p's currentColor, not the div's.)
>
> I suspect we need a new keyword for this case. Bikeshedding welcome.

Lea's proposal didn't include "auto" - it was suggested by me,
afterwards, and it didn't mean "currentcolor" (we'd just use
"currentcolor" for that), it meant the UA default.  That said, such a
thing isn't useful, as you can just use "initial" to get the default
behavior.

We can certainly add an "auto" or similar keyword that resolves to a
color at computed value time, so it inherits stably.  We could even
add it back as an ordinary <color>, if we can come up with a suitably
understandable name.

~TJ

Received on Friday, 15 August 2014 21:45:36 UTC