Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[focusgroup] Should focusgroup direction follow the DOM order or the visual order? #1044

Open
gfellerph opened this issue Apr 26, 2024 · 2 comments
Assignees

Comments

@gfellerph
Copy link
Contributor

gfellerph commented Apr 26, 2024

In the current version of the focusgroup explainer, the direction can be restricted to inline and block directions. However, there are many ways to alter the visual order of elements that can be combined in many different ways. A particularly cursed example would be this focusgroup maze on codepen.

The focusgroup maze - five numbered buttons rearranged with CSS to create a confusing tab order

In this example, the tab key moves focus through the buttons in DOM order. Because of the many directional changes applied in CSS, tabbing through the buttons seems to move the focus in random order (positions 4, 3, 5, 2, 1).

While this is the expected behavior of the tab key, it might be problematic for the arrow keys when pressing the right arrow key moves the focus visually to the left.

Which order should focusgroup follow when identifying the next candidate to focus?

  1. Should focusgroup always respect the visual order for selecting the next element to focus? (What would this mean for assistive technology?)
  2. Should focusgroup only support certain properties, e.g. writing-mode but not others like transform. If yes, what properties should be supported and which should not be supported?
  3. Should focusgroup move focus in DOM order (respecting limitations on up/down and left/right arrow keys based on inline or block direction)?

There are most likely other things to consider and more possible answers to the question.

@gfellerph gfellerph changed the title [focusgroup] Should focusgroup direction follow the tab order or the visual order? [focusgroup] Should focusgroup direction follow the DOM order or the visual order? Apr 26, 2024
@lukewarlow
Copy link
Collaborator

https://drafts.csswg.org/css-display-4/#reading-order-items - this feels relevant here

@travisleithead
Copy link
Collaborator

Interesting. From @lukewarlow's link, this line in the "Design Considerations" section seemed particularly relevant:

Linear navigation, focus sequencing order, and screen-reader order should always match, because there are users who use them together.

Would that imply that arrow key navigation would also jump around (like TAB) in the above cursed example because it would also be following DOM order (despite the weird visual appearance)? If a screen reader's perception of the content would follow the same DOM order logic, that would make the most sense to me from an accessibility standpoint...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants