Open scottaohara opened 9 months ago
Going this route would open the potential for both currently expected keyboard navigation to coexist with the modified and improved (regardless of all the concerns mentioned, the ARIA wg does want this proposal to succeed and acknowledges the need for it)
focusgroup
navigation. This wouldn't necessarily resolve the discoverability issue
I'm a bit confused by this. Accessibility resources have said for years that menus should be navigable by arrow keys. Are you saying that this is actually not expected and suffers from a discoverability issue? Some of the other issues sound like an education problem (MDN and other resources can tell developers the appropriate and inappropriate use cases. Using focusgroup
on a accordion sounds like a bad idea. Ditto putting form elements in a focusgroup
).
I'm wondering how many people will use the benefits of focusgroup if they have to learn to press a modifier key or change a default setting in their browser (and then do that on every different device they are using for every different browser they are using). Arrow keys in OS menus work without modifier and they should do the same on the web.
As for the accordion example, this is my understanding of how it should work: If there are focusable (visible) elements contained in the accordion content that are excluded from the focusgroup behaviour, then a tab press should honor DOM order (or natural focus order) and jump from the accordion heading to the content and out of the focusgroup. Only another tab press will return back to the focusgroup. Arrow keys presses should not be handled by the focusgroup if a non-candidate has focus.
<style>
/* Only headings are part of the focusgroup, syntax might be wrong */
accordion-heading { focusgroup-name: auto; }
</style>
<accordion-wrapper>
<accordion-heading>Heading 1</accordion-heading>
<accordion-panel>
<p>This is the first panel with a <a href="https://google.com">link to google</a>.</p>
</accordion-panel>
<accordion-heading>Heading 2</accordion-heading>
<accordion-panel>...</accordion-panel>
</accordion-wrapper>
If the headers are the only focusable elements in the accordion, a tab press would jump to the next focusable element outside of the accordion. Or at least this would be the default behaviour.
Here are some ideas:
<div focusgroup="tabbable">
. This would give authors the possibility to enhance a group of elements with arrow key navigation without interfering with tab expectations. Or do the opposite and make tab skipping behaviour opt-in with something like <div focusgroup="skip-tabs">
.<body focusgroup>
. In my naive world, the benefits overweigh the drawbacks the new tool will bring, it just highlights how important documentation and education is.I'm a bit confused by this. Accessibility resources have said for years that menus should be navigable by arrow keys. Are you saying that this is actually not expected and suffers from a discoverability issue?
@o-t-w i can see why you're asking this question. but no, the feedback i posted was meant to be specific to elements/components that do not have expectations for arrow key navigation. i've added an edit to my original post to hopefully clarify this a bit more.
@gfellerph, hopefully my answer to Oliver helps add some clarity per your response as well. Since you both jumped to talking about menus (so i obviously didn't do a good job at making people consider the actual problems the I and the ARIA wg were concerned with.)
We could specify a new option for the focusgroup that does not interfere with tab navigation... We could specify a modifier key that opts out of focusgroup behaviour to re-enable normal arrow key behaviour...
those sounds similar to what my comment was asking to be considered, so yes, let's all talk about these more - so long as there is a way for users to be in control and opt in/out, I think that'd be a reasonable path forward.
There will be people who'll write
<body focusgroup>
...
I would hope people wouldn't go and do stuff like that. but also, i've seen a number of websites where developers - thinking they were 'helping' - would put aria-hidden=true
on the body element (when their custom modal dialog opened), and instead they made their entire web page inaccessible.
the main bit of this feedback i really wanted to resonate with people was that though this idea has a lot of potential to make keyboard navigation easier for components where such behavior is expected - it also has a lot of potential to make things unpredictable (and potentially broken - per my comments about screen reader behavior last time I tested) for situations where arrow key navigation is not expected.
so per your comment:
I'm wondering how many people will use the benefits of focusgroup if they have to learn to press a modifier key or change a default setting in their browser
i guess i'd counter that and say how many people (users) will see the benefit in focusgroup if it results in common UI patterns (e.g., navigations, or arbitrary focusable elements within a web page) no longer being predictable for them to navigate? If there was a way to consistently visually call out the change in navigation behavior - or if focusgroup was limited in its use to the patterns where arrow key navigation was expected - this entire issue would probably be moot. But there isn't (at least, not yet?)
Again, apologies that my original comment made it seem like I was advocating for the use of a modifier key for patterns where there is already arrow key navigation expectations. But the point here is that while I think we all want this to make keyboard navigation easier to implement for the patterns where this navigation would be expected, it being used on anything outside of that has the potential to make navigation more confusing for the people it should be helping. And, much like putting aria-hidden=true
on the body element, the developers who do this would likely be none the wiser (it's not like there isn't a bunch of documentation/education on ARIA out there)... and misuse / unexpected use has the potential to hinder the people (users) this feature is supposed to help. So yeah. I want to try and prevent that as much as possible.
@scottaohara thanks for taking the time to write up the discussion outcomes from the ARIA WG, and for sharing the feature with them in the first place!
Let me replay the feedback in my own words to make sure I've got it correctly:
Those are some excellent points.
I too, am a bit nervous about how focusgroup + AT navigation will be impacted because I know there are a lot of heuristics and assumptions made in ATs for navigating HTML (which can be fragile) and that focusgroups enable the use of arrow keys in places not previously expected. I'd love to dig into the specific issues you found while testing the chromium prototype as I think that will be helpful in predicting what we might expect when pairing focusgroups and ATs.
Generally, I would hope we can address this feedback without needing to add an additional modifier key for use, though if not, then having an opt-out key combo would be my preference (moves things forward by default, which can be more painful initially, but is the right long-term solution for the web IMO).
Finally, a thought on discoverability--elements that use ARIA to mock-up a form control and add keyboard accessibility (or fail to do so) rarely offer any discoverability of the keyboard behavior--rather the pattern's role and built-in semantics of the element set the expectation for users. I would expect this to continue to be true for use of focusgroup. If focusgroup is used in an erroneous way (e.g., <body focusgroup>
) where there is no expectation of having default keyboard semantics, then I would not expect any users to discover it (in fact, it might feel like a bug depending on the context of use). If that case poses a problem for ATs (see points 1.a) then we need to fix that, but otherwise, I'm not sure I see how the extra keyboard behavior introduces a problem (except that its "unexpected") and thus doesn't need to be made overly discoverable in some UI form.
just quicky responding, will come back with more later: re: "Assistive Technology (or WCAG) navigation expectations" - just general expected UX for common patterns as well. again, a website navigation is not generally expected to be navigable via arrow keys. Having this be a developer-by-developer, website-by-website decision on whether or not to make the navigation a focusgroup navigation means that any keyboard user going to any website has no clue on what to expect for just standard page navigation. It now becomes a whack-a-mole trial and error on each web page, and for anything that bucks the norm, they have to keep track of that so when they return they remember "oh, this website is navigated differently because LOL"
elements that use ARIA to mock-up a form control and add keyboard accessibility (or fail to do so) rarely offer any discoverability of the keyboard behavior
yes and no? if ARIA is used correctly on the component and standard expectations for that component are properly implemented by the developer, then screen readers can absolutely make those commands known. E.g., JAWS has UX hints to tell people how to navigate common controls based on their established patterns.
Visually, and to some of the points that were made in the previous comments, menus, grids, tablists - they often follow common visual styling patterns, so they can be recognizable to users. Focusgroup going on whatever, including patterns where there is no uniform expectation for behavior (lol focusable cards... as if that term actually meant anything)
I've been thinking about this today, as well as some of the content in the "Why CSS toggles are too hard" paper, and thinking about it in terms of focusgroup. E.g., what are the accessibility semantics of focusgroup? How should we deal with conflicts with default element semantics? What about conflicts with ARIA roles? Would love to hear thoughts from @mfreed7 and @dbaron too. I'm wondering if focusgroup will end up meeting the same fate as CSS Toggles for similar reasons.
Here's a random dump of thoughts:
Putting a focusgroup
attribute on an element does convey some tiny bit of semantics, IMO. Something like "this element (whatever its original semantics) is also now a container for an arbitrary group of related focusable controls that can be reached via keyboard arrow keys". Is that useful for accessibility...? In the feature's current state, I would strongly recommend a best practice of also including a suitable 'role' attribute to beef up the semantic meaning and related expectations.
focusgroup=grid
. Perhaps we need to require more semantics for the other "linear" focusgroup use cases by making them explicit, such as focusgroup=listbox
or any number of other patterns, e.g., "menu", "menubar", "radiogroup", "tablist", "toolbar", "tree", "treegrid", in addition to "grid". This might also provide two additional benefits: 1) discourage use of focusgroup outside of established patterns (like on the body element as noted), and 2) automatically imply the associated role
on the given element (if not already provided). Conflicts between role and focusgroup semantic could be a problem.[EDIT - forked off issue #995 with the former additional thoughts in this comment]
The Open UI Community Group just discussed [focusgroup]: should focusgroup require the use of a modifier key? or ??? for unexpected patterns
.
From the above minutes:
masonf: there does seem to be a big question of whether a focusgroup becomes a single tab stop or numerous tab stops ..: there seems to be a tension there. As the developer I want this experience for my customers and I know it will be accessible
I put together a document to provide a bit more clarity on the above question: https://docs.google.com/document/d/1cOxjjZdvFfpexiN1x-MpNJLXrmbrR0xp1sRCTbaQ29c/
A digest of the CG discussion above:
<body>
or <html>
Roving tabindex with focusgroup (take 2)
Needs ability to opt out from memory mechanism as for example common pattern is using tabindex=0 on selected option and when you tab into/tab back into you always want that selected item to be first focused not the last item where you were (for example using arrows). From what I understand this will not be possible as memory mechanism takes priority before tabindex=0
@kbrilla that makes sense. I'll add this note to issue #537 and think about what the opt-out will look like.
There will be people who'll write
<body focusgroup>
... I would hope people wouldn't go and do stuff like that.a website navigation is not generally expected to be navigable via arrow keys
I would like to point out that these assertions are at best accurate only on desktops and laptops.
In particular, for smart TVs and game consoles, directional keys/buttons are the primary method of focus traversal. Tab key navigation does not apply. Therefore having the entire page be a focusgroup or utilize either a custom JS implemented or system provided directional focus system is a big improvement for the user experience when using a web browser, and an absolute requirement for building apps optimized for the platform and submitted to a store.
having worked on such interfaces, i understand your point - but also it should not require someone actually put a focusgroup on the entire body of a web page that is being used to create content that people would not know is actually web technology under the hood (unless of course they were using a screen reader with that platform - and then there are typically additional features provided by that AT which then one would also not want to have conflict with a focusgroup's behavior)
Back in August 2023, the ARIA WG discussed the focusgroup proposal. My apologies for taking so long to make this issue.
The following questions/concerns were raised:
Since focusgroup could apply to focusable content, including content that generally does not have wide expectations to be navigable via arrow keys (e.g., hyperlinks), what considerations can be/should be made to ensure that:
While I know the example in this linked comment is not necessarily meant to demonstrate how someone should use focusgroup, it being a potential valid example demonstrates both a markup pattern that could result in the JAWS/NVDA in/out of forms mode behavior I mentioned, as well as significantly buck user expectations for how such standard content should be navigated.
Outside of having screen readers be able to support arrow key behavior on elements that have not ever had an expectation of default arrow key navigation, and how to visually communicate this to people in general... is overriding standard arrow key behavior actually a good idea outside of the patterns (which are largely not native to the web platform and require someone use ARIA to build them now) where arrow key navigation is expected?
Take arrow key navigation through an accordion for example. On its surface this seems like something people might immediately think to do - allow for arrow key navigation to jump between the triggering elements for each accordion panel. The issue with this though is that an accordion panel can contain lots of content - and may/may not contain other focusable elements for the user to navigate to.
In the scenario where an accordion does contain focusable element (such as hyperlinks), what then is the expectation for the next tab key press if the accordion triggers are all part of the focus group? Should tab key go to the next accordion trigger, since it would have been the next focusable element if not for the focusgroup behavior? Or, would tab focus move to the next focusable element AFTER all the accordion triggers that participate in the focusgroup?
Next, let's consider an accordion that doesn't have any focusable content within its panels. While this might seem like a non-issue for people using large viewport sizes, people who have to zoom in to read content (1.4.4 Text Resize or 1.4.10 Reflow WCAG SCs) or who may just generally be on smaller screens but require the use of keyboard to navigate their device (bluetooth keyboards for touch devices). Arrow keys should allow these users to scroll the viewport so they can read the content. But if arrow key navigation is overwritten to instead move focus between the accordion triggers, then you get something like this - https://codepen.io/scottohara/pen/abMaxNx - where at the simulated Reflow viewport size, parts of the content cant be scrolled into view because arrow keys jump between the accordion buttons.
Too many words scott, again, what do you want?
The idea that some of these concerns could be resolved if arrow keys alone were not used as the default way to navigate focusgroup content (edit for clarity: specifically content that does not have a history of using arrow keys for navigation). (browsers could potentially include a toggle to allow users to make their own choice about whether they wanted to navigate focusgroup content by [modifier key} + arrow keys, or arrow keys alone).
Going this route would open the potential for both currently expected keyboard navigation to coexist with the modified and improved (regardless of all the concerns mentioned, the ARIA wg does want this proposal to succeed and acknowledges the need for it) focusgroup navigation.
This wouldn't necessarily resolve the discoverability issue, but arguably if people are made aware of this new feature / even purposefully opt into it, then they can start to expect it. E.g., it would be less frustrating to come to a website navigation and find that tab key doesn't work, and have to determine that they need to switch keyboard navigation methods to get to the page they want to - than it would to come to a web page and check to see if (for example) ctrl + arrow key works, and if it does great, and if it doesn't, well they then know the tab key will work.
If this solution doesn't hold water for some reason, that's fine. But, we do need to have a longer think on how to resolve the concerns mention in my word mess, above. I have other (lesser, imo) ideas of what could be done... but I'll save those for another time.