Skip to content

Commit 757cf6b

Browse files
committed
[css-scrollbars] Ensure sufficient contrast
UAs must ensure sufficient contrast themselves if they're not showing the scrollbar track. See #9855
1 parent e43d626 commit 757cf6b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

css-scrollbars-1/Overview.bs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,39 @@ Value Definitions</h3>
292292
Note: When a user interacts with a scrollbar (e.g. hovering or activating),
293293
implementations may alter which scrollbar colors apply to which scrollbar parts.
294294

295+
If the user agent displays the scrollbar without the [=track=],
296+
they must ensure reasonable contrast between the [=thumb=] and what is behind it.
297+
However, if the author set the color of the [=track=] to be fully transparent,
298+
the user agent may assume that the author has provided for sufficient contrast
299+
even with an invisible track.
300+
301+
Note: This is typically relevant in the case of [=overlay scrollbars=],
302+
either on platforms where the [=track=] is never displayed,
303+
or on platforms where it is only displayed
304+
when the scrollbar is being interacted with
305+
but not when scrolling with the mouse wheel or the track-pad.
306+
This does not apply in cases where the entire scrollbar is hidden
307+
as is often the case with [=overlay scrollbars=]
308+
while no scroll operation is ongoing
309+
<em>and</em> when the scrollbar is not being interacted with either.
310+
311+
<div class=note>
312+
Note: The user agent is free to achieve this by any of a variety of means,
313+
depending on the platform,
314+
on design choices,
315+
or on what is practical to implement,
316+
such as:
317+
318+
* Doing nothing if it can determine that contrast is already sufficient
319+
* Doing nothing if the design and geometry of the thumb ensures that some part of it will always be visible regardless of what is behind it
320+
* Adding an outline, shadow, or glow around the [=thumb=] to provide contrast (possibly using the [=track=] color as the contrasting color, or possibly using a different shade of the [=thumb=] color)
321+
* Adding some texture or geometry to the [=thumb=] so that it's color isn't uniform
322+
* Drawing the [=track=] anyway in cases where not doing so yields insufficient contrast
323+
* Replacing the [=thumb=] color with the [=track=] color when that provides better contrast
324+
* Altering the luminosity of the specified [=thumb=] color while preserving its hue
325+
* Disregarding the specified [=thumb=] color altogether and use automatically determined alternative
326+
</div>
327+
295328
<h3 id=color-compat>
296329
Interaction with non-standard features</h3>
297330

0 commit comments

Comments
 (0)