Skip to content

Commit 9958bc1

Browse files
committed
[css-ui-4] let authors control the speed at which the caret blinks
1 parent b18ba17 commit 9958bc1

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

css-ui-4/Overview.bs

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,102 @@ Abstract: This is a delta specification over CSS-UI Level 3.
8787

8888
Issue: Add final level 3 content
8989

90+
<h4 id="caret-blink-time">Blinking speed of the insertion caret: 'caret-blink-time'</h4>
91+
92+
<pre class='propdef'>
93+
Name: caret-blink-time
94+
Value: auto | <<time>>{1,2}
95+
initial: auto
96+
Applies to: elements that accept input
97+
Inherited: yes
98+
Percentages: N/A
99+
Media: interactive
100+
Computed value: Same as specified value, except if only 1 <<time>> is specified, in which case the computed value has 2 instances of <<time>>, both with the same value as the one which was specified.
101+
Animatable: no
102+
</pre>
103+
104+
On most platforms and in most UAs,
105+
the text insertion caret blinks.
106+
This property allows the author
107+
to control the speed at which it blinks,
108+
or to turn off blinking entirely.
109+
110+
When the computed value is ''caret-blink-time/auto'',
111+
the UA determines the speed at which the cursor blinks,
112+
if at all. It should follow platform conventions and settings.
113+
114+
If two <<time>> values are specified,
115+
the caret blinks.
116+
The first value indicates how long the caret stays on,
117+
and the second value how long the caret stays off.
118+
If the second value is ommitted,
119+
it defaults to the same as the first one.
120+
Both values must be zero or more.
121+
122+
If the second value is 0,
123+
or if both values are 0,
124+
the caret does not blink and is always on.
125+
126+
If the first value is 0 and the second is not,
127+
the caret is always off,
128+
making it effectively invisible.
129+
130+
Note: See <a href="http://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]].
131+
132+
<div class=example>
133+
The following rule gives a caret that stays on for 1 second,
134+
and off for half a second.
135+
<pre><code class="lang-css">
136+
input { caret-blink-time: 1s 500ms; }
137+
</code></pre>
138+
</div>
139+
140+
<div class=example>
141+
A user who is disturbed by or has adverse reactions to blinking visuals
142+
may want to make all carets static and non-blinking,
143+
regardless of platform defaults or author settings.
144+
This can be accomplished by with the folliwing rule in the user stylesheet.
145+
146+
<pre><code class="lang-css">
147+
:read-write { caret-blink-time: 0 !important; }
148+
</code></pre>
149+
</div>
150+
151+
<div class=example>
152+
Normally, the caret blinks between on and off.
153+
This makes it alternate between 2 colors.
154+
<pre><code class="lang-css">
155+
textarea {
156+
caret-blink-time: 0;
157+
caret-color: blue;
158+
animation: caret-alternate 2s step-end infinite;
159+
}
160+
@keyframes caret-alternate {
161+
from { caret-color: blue; }
162+
50% { caret-color: red; }
163+
}
164+
</code></pre>
165+
166+
The simulated rendering below illustrates how this would look.
167+
<style>
168+
@keyframes caret-alternate {
169+
from { border-color: blue; }
170+
50% { border-color: red; }
171+
}
172+
</style>
173+
<div style="border:inset; background: white; width: 10em;">
174+
Text area
175+
with color-alternating caret<span style="border-right: 2px solid blue;animation: caret-alternate 2s step-end infinite;"></span>
176+
</div>
177+
178+
Issue: This example does not work
179+
because caret-color is currently marked as not annimatable.
180+
This is probably wrong.
181+
</div>
182+
183+
184+
185+
90186
<h3 id="keyboard">Keyboard control</h3>
91187

92188
<h4 id="nav-dir">Directional focus navigation: the 'nav-up', 'nav-right', 'nav-down', 'nav-left' properties</h4>

0 commit comments

Comments
 (0)