Hi, Chrome DevRel here 👋
I saw that in whatwg/html#12273 @keithamus challenged us/me to come up with a different way of doing things.
flackr: devrel said that the button is awful
keithamus: i could imagine the pushback, and i would challenge them and wonder whether theres another way to do it
Well, I think I have something, so here goes …
Table of Contents:
The Main Take
In the current proposal for Declarative Overscroll Actions an HTML attribute on the container is used as the opt-in mechanism to enable overscroll areas.
First, the container needs to be identified as supporting overscroll areas. This is done by specifying overscrollcontainer attribute on the container.
To cut to the chase, I think that using an attribute as an opt-in mechanism is wrong, and I believe that, instead, this opt-in should be done through CSS.
There is also the command button to toggle overscroll that is part of the proposal:
Second, we introduce a new command value, toggle-overscroll, to bind a trigger button to both the container (the scroll port) and the content (the element hidden in the overscroll area).
In a previous iteration of the proposal, this button was also necessary to make something an overscroll area (see this (outdated) code example), but that — thankfully — is no longer the case: the command button is nowadays only concerned with scrolling an overscroll area into or out of view.
(So to correct the meeting minutes: devrel said that the button is awful as the way to make something an overscroll area ;))
But, why CSS then?
In my perception, Overscroll Areas are very much layout dependent: depending on what screen size you are looking at something, an element might always be in view (e.g. on the big screen layout) or tucked away behind a button that can toggle it (e.g. on the small screen layout).
Furthermore some Overscroll Areas may be presented without a Command Button to overscroll that area being present at all.
Finally, a container might have multiple overscroll areas, each with their own overlay mode, so one single attribute on the container won’t cut it.
Let’s take a look at some examples to clarify this …
Example 1: Navigation / Drawer Menu
Let’s look at a navigation menu. On a large screen layout this would be a side-column that is typically placed next to the content. On a small screen layout this becomes a drawer menu that you either reveal by pressing a hamburger button somewhere or — and this is what overscroll areas try to achieve — by scrolling from the edge of the screen to reveal said menu.
This is a common pattern on sites, for example on Bsky:
Figure: Bluesky on a large screen. The menu is positioned to the left of the main content column.
| Closed Menu |
Open Menu |
 |
 |
Figure: Bluesky on a small screen. The menu becomes a drawer menu that gets actived by a hamburger button. When visible, the drawer menu lays on top of the content. On a touchscreen device, a swipe gesture also reveals the menu.
If overscroll areas are defined in the markup (as it currently stands in the explainer), then there is no way to conditionally toggle that, whereas in CSS you can put this type of thing in a Media Query / Container Query.
Example 2: E-mail Interface
Another example is an e-mail interface. On the overview view you have a list of emails, and upon clicking one you go into a detail view that features the e-mail itself along with some buttons to reply, archive, etc.
Figure: The overview view of a fictitious e-mail interface. Shown are 4 emails. Some of these are favorited and/or unread.
Figure: The detail view of a fictitious e-mail interface. Included in this view is a back button and an action bar. The action bar has buttons to archive, favorite, and mark as unread.
What a lot of mobile interfaces do is augment the overview view by adding extra actions behind swipe gestures per e-mail.
Figure: The overview view of a fictitious e-mail interface, with some emails having their swipe actions revealed. When swiping from the left a “Mark as (un)read” button is presented. When swiping from the right a “Archive” button is presented.
While these swipe actions could be visible on both small and large screens, there are no command buttons present to reveal these overscroll actions. The archive and toggle buttons you see there are different buttons.
But what about Accessibility?
Good, I thought you’d never ask 🙃
Interfaces should already be accessible
Interfaces that get augmented with overscroll gestures should already be accessible regardless of overscroll gestures being added to it or not.
Applied to the Drawer Menu
In the case of the drawer menu example, a developer MUST already have a command button in place to show / hide that sidebar.
The current API proposal already has this in place, namely a command button that can send a toggle-overscroll command.
<button commandfor="menu" command="toggle-overscroll" id=btn aria-label="Reveal Menu">☰</button>
This button is still very much necessary, as it makes the interface accessible: you can tab into it, activate it to reveal the drawer menu, etc.
As a reminder: unlike the current proposal, this button here is not used for the opt-in to create an overscroll region, but it is used only for scrolling that overscroll area into view.
Applied to the E-mail Interface
As for the e-mail client interface: the actions that are exposed by the gestures should already be reachable through the regular UI.
Practically speaking, I would expect to be able to tab through the list of emails, and when at the e-mail detail view, I would expect that detail view to have buttons to archive the email and toggle its read state.
Therefore, I don’t think that this interface should have a command button with toggle-overscroll, because a user can already perform the actions that are tucked away through another mechanism or path.
(I think of this similar to adding keyboard shortcuts to an interface. While very handy, the actions that these shortcuts do can already be achieved through the interface)
Use aria-actions when there is no command button to toggle an overscroll area
To present these extra actions tucked away behind overscroll areas, aria-actions (See issue w3c/aria#1440 and accompanying (WIP) PR w3c/aria#1805) should be used to expose these in an accessible way.
In the drawer menu example this is not necessary, because there are already command buttons in the markup to either show or hide the menu.
In the e-mail interface using aria-actions is very much necessary because there are no command buttons.
By setting the aria-actions on the e-mail div to point to the already present buttons for archiving and toggling the read/unread state, this can be achieved:
<div class=email aria-actions="toggleread,archive">
<a href="detail.html">…</a>
<button id="toggleread" aria-label="Mark as read"><icon … /></button>
<button id="archive" aria-label="Archive E-mail"><icon … /></button>
</div>
The exact markup is dependent on what aria-actions will end up looking like, but you should get the idea here: you link up the existing buttons (the very same ones presented to users who use overscroll) through aria-actions.
So, what would a CSS opt-in look like?
(Everything in this section is informational, but I did want to share it with you to give the full picture of how I think about Overscroll Areas.)
I don’t want to hinge this discussion on the exact shape of what this should look like, I am mainly seeking an agreement on that, perhaps, Overscroll Areas should be a CSS opt-in instead of an HTML opt-in.
However, I did my homework and created a prototype which you find at https://major-butterfly-redfish.codepen.app/ for you to explore. I’ve checked basic tabbing behavior, and VoiceOver announcing things, but nothing more.
Here’s a quick write-up of how it behaves. There is a lot of overlap with how the feature currently behaves, so not that much should be new:
- Overscroll areas use scroll-snapping
- Non-visible areas of overscroll areas are inerted, so you can’t tab into them.
- The
toggle-overscroll command only makes that overscroll area visible, it doesn’t activate anything inside the now visible overscroll area.
- After an overscroll area becomes visible, there is a lot of behavior similar to a modal dialog being shown:
- the rest of the contents in the parent scroller are inerted
- the first focusable element inside the overscroll area gets focused
- If there is no such element, the entire area gets focused.
- visible overscroll areas are light dismissable
- there are styleable backdrops
Some other things worth nothing with this proposal:
- (NEW) Overscroll Areas can be toggled on and off with Media Queries (or other conditions)
- (NEW) The opt-in is coupled with a positioning scheme that is inspired by anchor positioning’s 9-box grid and/or grid areas.
- (NEW) An Overscroll Area is a size container by default. Content inside an overscroll area can use container query units.
- (NEW) It is possible to define multiple overscroll areas, each with their own overlay mode. For example, content on the left can be “overlay”, whereas content on the right can be “normal” or “underlay”.
Again, please note that the CSS syntax from that prototype is not the core of this issue and is something that — if there is agreement on putting this in CSS — would need to be discussed at the CSS Working Group. The core of this issue is to get an agreement on that, perhaps, Overscroll Areas should be a CSS opt-in instead of an HTML opt-in.
/cc @vmpstr @flackr
Hi, Chrome DevRel here 👋
I saw that in whatwg/html#12273 @keithamus challenged us/me to come up with a different way of doing things.
Well, I think I have something, so here goes …
Table of Contents:
aria-actionswhen there is no command button to toggle an overscroll areaThe Main Take
In the current proposal for Declarative Overscroll Actions an HTML attribute on the container is used as the opt-in mechanism to enable overscroll areas.
To cut to the chase, I think that using an attribute as an opt-in mechanism is wrong, and I believe that, instead, this opt-in should be done through CSS.
There is also the command button to toggle overscroll that is part of the proposal:
In a previous iteration of the proposal, this button was also necessary to make something an overscroll area (see this (outdated) code example), but that — thankfully — is no longer the case: the command button is nowadays only concerned with scrolling an overscroll area into or out of view.
(So to correct the meeting minutes: devrel said that the button is awful as the way to make something an overscroll area ;))
But, why CSS then?
In my perception, Overscroll Areas are very much layout dependent: depending on what screen size you are looking at something, an element might always be in view (e.g. on the big screen layout) or tucked away behind a button that can toggle it (e.g. on the small screen layout).
Furthermore some Overscroll Areas may be presented without a Command Button to overscroll that area being present at all.
Finally, a container might have multiple overscroll areas, each with their own overlay mode, so one single attribute on the container won’t cut it.
Let’s take a look at some examples to clarify this …
Example 1: Navigation / Drawer Menu
Let’s look at a navigation menu. On a large screen layout this would be a side-column that is typically placed next to the content. On a small screen layout this becomes a drawer menu that you either reveal by pressing a hamburger button somewhere or — and this is what overscroll areas try to achieve — by scrolling from the edge of the screen to reveal said menu.
This is a common pattern on sites, for example on Bsky:
Figure: Bluesky on a large screen. The menu is positioned to the left of the main content column.
Figure: Bluesky on a small screen. The menu becomes a drawer menu that gets actived by a hamburger button. When visible, the drawer menu lays on top of the content. On a touchscreen device, a swipe gesture also reveals the menu.
If overscroll areas are defined in the markup (as it currently stands in the explainer), then there is no way to conditionally toggle that, whereas in CSS you can put this type of thing in a Media Query / Container Query.
Example 2: E-mail Interface
Another example is an e-mail interface. On the overview view you have a list of emails, and upon clicking one you go into a detail view that features the e-mail itself along with some buttons to reply, archive, etc.
Figure: The overview view of a fictitious e-mail interface. Shown are 4 emails. Some of these are favorited and/or unread.
Figure: The detail view of a fictitious e-mail interface. Included in this view is a back button and an action bar. The action bar has buttons to archive, favorite, and mark as unread.
What a lot of mobile interfaces do is augment the overview view by adding extra actions behind swipe gestures per e-mail.
Figure: The overview view of a fictitious e-mail interface, with some emails having their swipe actions revealed. When swiping from the left a “Mark as (un)read” button is presented. When swiping from the right a “Archive” button is presented.
While these swipe actions could be visible on both small and large screens, there are no command buttons present to reveal these overscroll actions. The archive and toggle buttons you see there are different buttons.
But what about Accessibility?
Good, I thought you’d never ask 🙃
Interfaces should already be accessible
Interfaces that get augmented with overscroll gestures should already be accessible regardless of overscroll gestures being added to it or not.
Applied to the Drawer Menu
In the case of the drawer menu example, a developer MUST already have a command button in place to show / hide that sidebar.
The current API proposal already has this in place, namely a command button that can send a
toggle-overscrollcommand.This button is still very much necessary, as it makes the interface accessible: you can tab into it, activate it to reveal the drawer menu, etc.
As a reminder: unlike the current proposal, this button here is not used for the opt-in to create an overscroll region, but it is used only for scrolling that overscroll area into view.
Applied to the E-mail Interface
As for the e-mail client interface: the actions that are exposed by the gestures should already be reachable through the regular UI.
Practically speaking, I would expect to be able to tab through the list of emails, and when at the e-mail detail view, I would expect that detail view to have buttons to archive the email and toggle its read state.
Therefore, I don’t think that this interface should have a command button with
toggle-overscroll, because a user can already perform the actions that are tucked away through another mechanism or path.(I think of this similar to adding keyboard shortcuts to an interface. While very handy, the actions that these shortcuts do can already be achieved through the interface)
Use
aria-actionswhen there is no command button to toggle an overscroll areaTo present these extra actions tucked away behind overscroll areas,
aria-actions(See issue w3c/aria#1440 and accompanying (WIP) PR w3c/aria#1805) should be used to expose these in an accessible way.In the drawer menu example this is not necessary, because there are already command buttons in the markup to either show or hide the menu.
In the e-mail interface using
aria-actionsis very much necessary because there are no command buttons.By setting the
aria-actionson the e-maildivto point to the already present buttons for archiving and toggling the read/unread state, this can be achieved:The exact markup is dependent on what
aria-actionswill end up looking like, but you should get the idea here: you link up the existing buttons (the very same ones presented to users who use overscroll) througharia-actions.So, what would a CSS opt-in look like?
(Everything in this section is informational, but I did want to share it with you to give the full picture of how I think about Overscroll Areas.)
I don’t want to hinge this discussion on the exact shape of what this should look like, I am mainly seeking an agreement on that, perhaps, Overscroll Areas should be a CSS opt-in instead of an HTML opt-in.
However, I did my homework and created a prototype which you find at https://major-butterfly-redfish.codepen.app/ for you to explore. I’ve checked basic tabbing behavior, and VoiceOver announcing things, but nothing more.
Here’s a quick write-up of how it behaves. There is a lot of overlap with how the feature currently behaves, so not that much should be new:
toggle-overscrollcommand only makes that overscroll area visible, it doesn’t activate anything inside the now visible overscroll area.Some other things worth nothing with this proposal:
Again, please note that the CSS syntax from that prototype is not the core of this issue and is something that — if there is agreement on putting this in CSS — would need to be discussed at the CSS Working Group. The core of this issue is to get an agreement on that, perhaps, Overscroll Areas should be a CSS opt-in instead of an HTML opt-in.
/cc @vmpstr @flackr