Open flackr opened 2 months ago
I can see in the linked demo that there is a table of contents on the left and circles on the right. Is the idea that each of these things would have focusgroup on them? What would the author code look like?
Edit: Maybe I'm just not up to speed on this work, I thought that the use case involved generated pseudo-elements that I've seen in other carousel use cases
The CSS Working Group just discussed [css-overflow-5] Creating scroll-marker groups within which to select an active marker
, and agreed to the following:
RESOLVED: Enabling active scroll marker styling and grouping should be done via CSS properties
Based on the previous discussion and resolution, I propose we add a scroll-marker-contain: auto | none
property for grouping scroll-markers. An element having scroll-marker-contain: auto
is a scroll marker group container establishing a group of all of the scroll marker elements for which this is the nearest ancestor scroll marker group container.
Having a property on an ancestor rather than having the markers themselves name a group allows for easy re-use. E.g. you can have multiple group containers throughout the page re-used in various components without needing to give them unique names. Name scoping would be possible, but then we would need an ancestor property to scope the name anyways.
We might be able to explain the pseudo grouping behavior by saying that the UA stylesheet includes:
::scroll-marker-group {
scroll-marker-contain: auto !important;
}
Note that when scrolling we would still set the last-focused element of an ancestor focusgroup to the selected marker so that when used with focusgroup the active marker becomes the tab stop in a focus group with all elements having a tabindex
of -1.
@flackr, can you outline all the effects of defining a list of links (e.g. a ToC) to be a scroll marker group using the proposed scroll-marker-contain
property?
You'd definitely get the scroll-marker-related behaviors - the links are capable of matching :target-current, and the set of links in the group divvy up the document and its scrollers into regions associated with each.
Ideally we'd also get the focusgroup
behavior, where the entire group is a single tabstop, the arrow keys move focus within the group, and the group remembers its last selected option when you tab out of it so it can reselect the same one when you tab back to it (or, if you've scrolled since then, it selects the one currently matching how the page is scrolled).
The main thing is that one of the markers within the scroll-marker-contain: auto
group would match :target-current
.
Ideally we'd also get the
focusgroup
behavior, where the entire group is a single tabstop, the arrow keys move focus within the group).
We could apply focus-group behavior or we could leave focusgroup as an independent thing you might want to set. On its own, applying focusgroup only makes it so that when one is focused you can move to the other links by using the arrow keys (see the links on the left-hand side of https://flackr.github.io/carousel/examples/scroll-marker/scrolltarget/ ).
and the group remembers its last selected option when you tab out of it so it can reselect the same one when you tab back to it (or, if you've scrolled since then, it selects the one currently matching how the page is scrolled
This particular behavior is only if you also set tabindex=0 (see the links on the right-hand side of https://flackr.github.io/carousel/examples/scroll-marker/scrolltarget/ ). If there are focusable elements within the focusgroup you can't tell that there is a last focused element
There is also a question of if this changes the activation behavior. Normally activating a link <a href="#target">
will perform a "navigation" updating the URL, and scroll every scroller to the root into view. I think that the simplest would be to keep the full activation behavior (when clicked or focused and activated, not when focusing it via arrow keys in the focus group which would only scroll).
In order to be able to select one active scroll marker among many potential options, we need a way to establish a group of scroll markers.
In https://flackr.github.io/carousel/examples/scroll-marker/scrolltarget/ there are situations in which more than one group is desired (TOC section selector on left is one group, chapter selector icons on right is another group), as well as where some anchor links should not be part of the group (e.g. the inline links to other sections within the document should not be made active.
The current draft specification establishes a group by having an ancestor with a specified
focusgroup
value, however there are other options. Should we:focusgroup
as the mechanism for creating a scroll marker group. It seems to have the correct semantics, though there we may want an alternative as:Add a named mechanism. If so, we'd have to decide whether this is:
name
attribute, however name already has a defined meaning on links so we would need to choose something else, maybe group?And whether this is a property on each participating link (similar to radio buttons) or on an ancestor (similar to focusgroup).
These options are not necessarily mutually exclusive. We could implicitly create marker groups from focusgroup, but also allow explicitly putting them in a named group.