W3C home > Mailing lists > Public > www-style@w3.org > May 2010

Re: UA's implementation of ::selection

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Sat, 15 May 2010 21:41:40 +0200
Message-ID: <4FEAC09DEA9A4A7B942388E70B3FB31F@FREMY2>
To: "Brad Kemper" <brad.kemper@gmail.com>, "David Hyatt" <hyatt@apple.com>
Cc: "Boris Zbarsky" <bzbarsky@MIT.EDU>, <www-style@w3.org>
From: "Brad Kemper" <brad.kemper@gmail.com>
>
> On May 15, 2010, at 2:24 AM, David Hyatt wrote:
>
>> Yeah this seems reasonable to me.  I'll make that change in WebKit.
>>
>> dave
>
> Wait; whaaaat?
>
> If I do this...
>
> p { color:#999; }
> p::selection { color:black; }
>
> ...then I will no longer get the UA text-selection background-color? That 
> does not seem reasonable at all to me.

Well, it's. When you specify a selection color,
you should not rely on the "default" selection
background-color.

Imagine we're on an OS for which the default
selection highlight is white text on black bg.
Your rule may end up by having no readable
text on the screen when the selection occur.

By forcing the developer to specify a background
color, we avoid this problem (at least, we suppose
the author will use a readable bg/color combination).

Please note it's the behavior of both IE and Opera.

>>
>> On May 15, 2010, at 3:17 AM, François REMY wrote:
>>
>>> It seems preferable to not apply a background
>>> when no background is specified in the
>>> ::selection.
>>>
>>> Using the default selection background seems
>>> very bad in an accessibility point of view because
>>> the developer is unable to determine which
>>> color will be used (so, the text may end up to be
>>> nearly unreadable in some UA while perdectly
>>> readable in some others, due to UA or OS settings.
>>>
>>> The solution of IE and Opera is here to use no
>>> background for selection when no background
>>> is specified. When no text color is specified, the
>>> original color of the text is used instead.
>>>
>>>
>>> --------------------------------------------------
>>> From: "Boris Zbarsky" <bzbarsky@MIT.EDU>
>>> Sent: Saturday, May 15, 2010 6:10 AM
>>> To: "David Hyatt" <hyatt@apple.com>
>>> Cc: "François REMY" <fremycompany_pub@yahoo.fr>; <www-style@w3.org>
>>> Subject: Re: UA's implementation of ::selection
>>>
>>>> On 5/15/10 12:04 AM, David Hyatt wrote:
>>>>> The chosen colors for selection in the absence of any specified pseudo 
>>>>> element come from the platform.  We have both active and inactive 
>>>>> foreground and background colors (so 4 total possible different 
>>>>> colors). If the pseudo element specifies only a background color and 
>>>>> not a foreground color, we'll use the platform foreground color (and 
>>>>> vice versa).  Any specified selection colors in the pseudo element 
>>>>> will be used in both the active and inactive states.
>>>>
>>>> That doesn't really explain the behavior I see with "background: none" 
>>>> vs "background: transparent"... (which should give equivalent specified 
>>>> values, note).
>>>>
>>>> -Boris
>>>
>>>
>>
>>
>
> 
Received on Saturday, 15 May 2010 19:43:48 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:27 GMT