Skip to content

Commit 4afcff0

Browse files
committed
[css-overflow-5] Define ::scroll-button(). #10722
1 parent 32dab47 commit 4afcff0

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

css-overflow-5/Overview.bs

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,99 @@ The 'scroll-marker-group' property</h4>
339339
the next tabindex-ordered focus navigation will focus the [=scroll target=] if it is focusable,
340340
otherwise, it will find the next focusable element from this <var>element</var> as though it were focused.
341341

342+
<h2 id="scroll-buttons">
343+
Scroll Buttons</h2>
344+
345+
The <dfn>::scroll-button( <<scroll-button-direction>> )</dfn> pseudo-elements
346+
are generated on [=scroll containers=]
347+
when their computed 'content' value is not ''content/none''.
348+
They generate boxes as if they were immediate children
349+
of their [=originating element=],
350+
with content as specified by 'content'.
351+
They exist after their [=originating element's=] ''::scroll-marker-group'' pseudo-element
352+
(when used with ''scroll-marker-group: before'')
353+
and before its ''::before'' pseudo-element,
354+
if those exist.
355+
356+
Four distinct ''::scroll-button()'' pseudo-elements can exist on a [=scroll container=],
357+
each associated with a [=logical=] direction,
358+
based on their [=originating element's=] [=writing mode=]:
359+
in order, [=block-start=], [=inline-start=], [=block-end=], and [=inline-end=].
360+
The ''::scroll-button()'' pseudo-elements are both focusable and activatable by default,
361+
with their activation behavior being to scroll their [=originating element=]
362+
by one "page" in their associated direction,
363+
similar to pressing PgUp/PgDn keys.
364+
<span class=note>(Usually, this will be about 85% of the [=scrollport=] size.)</span>
365+
Like those keys, this scroll has an [=intended direction and end position=].
366+
367+
Issue: [[CSSOM-VIEW-1]] will grow a "scroll by pages" algorithm,
368+
at which point this can reference that.
369+
See <a href="https://github.com/w3c/csswg-drafts/issues/10914#issuecomment-2380139977">
370+
the resolution on issue #10914</a>.
371+
372+
Issue: Is this the best order for the buttons?
373+
This does match the usual ordering of logical directions in CSS,
374+
but similar buttons created manually
375+
are usually either ordered with verticals and horizontals each grouped together
376+
(aka block-start/block-end then inline-start/inline-end)
377+
or the verticals "around" the horizontals
378+
(aka block-start/inline-start/inline-end/block-end).
379+
380+
The four ''::scroll-button()'' pseudo-elements are individually selected
381+
by the selector's argument.
382+
The possible <dfn><<scroll-button-direction>></dfn> values are:
383+
384+
<dl dfn-type=value for="<scroll-button-direction>, ::scroll-button()">
385+
: <dfn>up</dfn>
386+
: <dfn>down</dfn>
387+
: <dfn>left</dfn>
388+
: <dfn>right</dfn>
389+
:: Selects the ''::scroll-button()' corresponding to the given physical direction.
390+
391+
: <dfn>block-start</dfn>
392+
: <dfn>block-end</dfn>
393+
: <dfn>inline-start</dfn>
394+
: <dfn>inline-end</dfn>
395+
:: Selects the indicated ''::scroll-button()'' pseudo-element.
396+
397+
: <dfn>prev</dfn>
398+
::
399+
Selects either the [=block-start=] or [=inline-start=] ''::scroll-button()'',
400+
whichever's axis has more "scrollable pages" in the [=originating element=]:
401+
the [=originating element's=] [=scrollable overflow height=]
402+
divided by its [=scrollport=] height,
403+
or the same but for widths.
404+
405+
If both dimensions are equally sized,
406+
selects the [=block-start=] ''::scroll-button()''.
407+
408+
<p class=example>
409+
For example, say the [=originating element=]
410+
was 800px wide and 500px tall,
411+
while its [=scrollable overflow area=]
412+
was 1200px wide and 1000px tall.
413+
The horizontal scrolling thus represents 1.5 "pages" (1200/800),
414+
while the vertical scrolling represents 2 "pages" (1000/500),
415+
so (assuming the element is in English)
416+
the ''::scroll-button(prev)'' selector
417+
would select the [=block-start=] button.
418+
419+
: <dfn>next</dfn>
420+
:: Identical to ''::scroll-button()/prev'',
421+
except it selects the [=block-end=] or [=inline-end=] ''::scroll-button()'' instead.
422+
</dl>
423+
424+
Issue: Do we want to add some multi-button keywords
425+
to make it easier to style several buttons the same way?
426+
In particular, <css>all</css> is probably useful,
427+
but maybe also <css>horizontal</css>/<css>vertical</css>/<css>block</css>/<css>inline</css>.
428+
429+
The ''::scroll-button()''s are [=fully stylable pseudo-elements=]: there is no restriction on what properties apply to them.
430+
431+
Issue: The UA stylesheet needs to specify that ''::scroll-button()''s
432+
are styled identically to the <{button}> element.
433+
434+
342435
<h2 id="fragmentation" class=no-num>
343436
Appendix A: Redirection of Overflow</h2>
344437

0 commit comments

Comments
 (0)