Skip to content

Commit 58d739b

Browse files
committed
[css-ui] Add the caret-animation property
See w3c#9707
1 parent 8281770 commit 58d739b

File tree

1 file changed

+28
-43
lines changed

1 file changed

+28
-43
lines changed

css-ui-4/Overview.bs

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,13 +1127,12 @@ Coloring the Insertion Caret: the 'caret-color' property</h4>
11271127
</div>
11281128

11291129

1130-
<!--
11311130
<h4 id="caret-animation">
11321131
Animation of the insertion caret: 'caret-animation'</h4>
11331132

11341133
<pre class='propdef'>
11351134
Name: caret-animation
1136-
Value: auto | blink | none | fade
1135+
Value: auto | manual
11371136
Initial: auto
11381137
Applies to: elements that accept input
11391138
Inherited: yes
@@ -1145,9 +1144,7 @@ Animation of the insertion caret: 'caret-animation'</h4>
11451144
On most platforms and in most UAs,
11461145
the text insertion caret blinks.
11471146
This property allows the author
1148-
to control the speed at which it blinks,
1149-
or to turn off blinking entirely.
1150-
1147+
to take control over the way the caret is animated.
11511148

11521149
<dl dfn-type=value dfn-for=caret-animation>
11531150
<dt><dfn>auto</dfn>
@@ -1157,43 +1154,35 @@ Animation of the insertion caret: 'caret-animation'</h4>
11571154
and may be adjusted based on context.
11581155

11591156
Note: This is typically rendered as a blinking caret.
1157+
Fading in and out instead of blinking is a variant that appears in some environments.
11601158

1161-
<dt><dfn>blink</dfn>
1162-
<dd>
1163-
The UA must display a blinking caret.
1164-
For accessibility reasons, and based on user preferences,
1165-
the UA may display a non-animated caret instead.
1166-
1167-
<dt><dfn>none</dfn>
1159+
<dt><dfn>manual</dfn>
11681160
<dd>
11691161
The UA must not animate the caret.
11701162

11711163
Note: This is only about UA driven animations of the caret.
1172-
If CSS animations are used to animate the caret color,
1173-
these should still apply normally.
1174-
1175-
<dt><dfn>fade</dfn>
1176-
<dd>
1177-
The UA must display a caret repeatedly fading in and out,
1178-
similarly to ''caret-animation/blink'' except it appears and
1179-
disappears progressively rather than suddenly.
1180-
For accessibility reasons, and based on user preferences,
1181-
the UA may display a non-animated caret instead.
1164+
When CSS animations are used to animate the caret color,
1165+
they apply normally.
11821166
</dl>
11831167

1184-
Issue: Do we need the accessibility escape hatch on blink and fade?
1185-
Would it be enough instead to expect the UI to put
1186-
<code>caret-animation:fixed !important</code> in the
1187-
user stylesheet when it wants to prevent the caret
1188-
from blinking?
1189-
1190-
The UA determines the speed at which the cursor blinks or fades.
1168+
The UA determines the speed at which the cursor animates (blinks, fades…).
11911169
It should follow platform conventions and settings.
11921170

1193-
Note: It is recommended to stop the caret from blinking or fading
1194-
using ''caret-animation: none''
1171+
Note: It is recommended for authors to stop the caret from blinking or fading
1172+
using ''caret-animation: manual''
11951173
when applying custom animations using [[CSS3-ANIMATIONS]],
1196-
to prevent the blinking or fading and the CSS animation to interfere.
1174+
to prevent the UA's animation and the CSS animation to interfere.
1175+
1176+
<div class=advisement>
1177+
If a user agent is unwilling to yield control of caret animmations
1178+
to page authors and would not honor ''caret-animation: manual'',
1179+
it must not implement the property at all.
1180+
1181+
Note:
1182+
This enables authors to use <code highlight="css">@supports (caret-animation: manual) { … }</code>
1183+
to gate code that would depend on this functionality.
1184+
See [[CSS-CONDITIONAL-3]].
1185+
</div>
11971186

11981187
Note: See <a href="https://www.w3.org/TR/WCAG20/#seizure">Guideline 2.3: Seizures: Do not design content in a way that is known to cause seizures</a> [[WCAG20]].
11991188

@@ -1205,10 +1194,10 @@ Animation of the insertion caret: 'caret-animation'</h4>
12051194

12061195
<pre><code class="lang-css">
12071196
/* prevent the caret from blinking/flashing */
1208-
:read-write { caret-animation: none !important; }
1197+
:read-write { caret-animation: manual !important; }
12091198

12101199
/* prevent changes of caret-color, including animations */
1211-
:read-write { caret-color:auto !important; }
1200+
:read-write { caret-color: auto !important; }
12121201
</code></pre>
12131202
</div>
12141203

@@ -1223,11 +1212,11 @@ Animation of the insertion caret: 'caret-animation'</h4>
12231212
for details.
12241213

12251214
<div class=example>
1226-
Normally, the caret blinks between on and off.
1215+
Typically, the caret blinks between on and off.
12271216
This makes it alternate between 2 colors.
12281217
<pre><code class="lang-css">
12291218
textarea {
1230-
caret-animation: none;
1219+
caret-animation: manual;
12311220
caret-color: blue;
12321221
animation: caret-alternate 2s step-end infinite;
12331222
}
@@ -1258,7 +1247,6 @@ Animation of the insertion caret: 'caret-animation'</h4>
12581247
animation: caret-alternate-test 2s step-end infinite;"
12591248
>Text area with color-alternating caret</div>
12601249
</div>
1261-
-->
12621250

12631251

12641252
<h4 id="caret-shape">
@@ -1429,10 +1417,9 @@ Shape of the insertion caret: 'caret-shape'</h4>
14291417
<h4 id="caret">
14301418
Insertion caret shorthand: 'caret'</h4>
14311419

1432-
<!-- Value: <<'caret-color'>> || <<'caret-animation'>> || <<'caret-shape'>> -->
14331420
<pre class='propdef shorthand'>
14341421
Name: caret
1435-
Value: <<'caret-color'>> || <<'caret-shape'>>
1422+
Value: <<'caret-color'>> || <<'caret-animation'>> || <<'caret-shape'>>
14361423
Initial: auto
14371424
Applies to: elements that accept input
14381425
Inherited: yes
@@ -1443,7 +1430,6 @@ Shape of the insertion caret: 'caret-shape'</h4>
14431430
'caret-color' <!--, 'caret-animation'--> and 'caret-shape' in one declaration.
14441431
Omitted values are set to their initial values.
14451432

1446-
<!--
14471433
<div class=example>
14481434
This example illustrates using the various caret related properties
14491435
in combination.
@@ -1452,7 +1438,7 @@ Shape of the insertion caret: 'caret-shape'</h4>
14521438

14531439
<pre><code class="lang-css">
14541440
#old-screen {
1455-
caret: block none;
1441+
caret: block manual;
14561442
animation: old-caret 2s infinite;
14571443
/*styling of the screen omitted for brevity */
14581444
}
@@ -1475,7 +1461,7 @@ Shape of the insertion caret: 'caret-shape'</h4>
14751461
.old-screen span {
14761462
display:inline-block;
14771463
white-space: pre;
1478-
caret: block 0s;
1464+
caret: block manual;
14791465
animation: caret-old-ref 2s infinite;
14801466

14811467
}
@@ -1489,7 +1475,6 @@ Shape of the insertion caret: 'caret-shape'</h4>
14891475
Focus the element below to see how your browser renders it.
14901476
<div class="old-screen" contentEditable="true" style="height: 100px">&gt; </div>
14911477
</div>
1492-
-->
14931478

14941479

14951480
<h3 id="keyboard">

0 commit comments

Comments
 (0)