-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
tabindex vs reading-flow property #10642
Comments
From the conversation at issue 10533, there are some good feedback about tabindex. Right now, tabindex is already ignored in the accessibility tree. This causes confusion for users when they switch from using focus navigation to the screen reader. Further, positive tabindex values are bad because it causes confusion to the users and causes the order to jump around. Developers historically have also not been reliable about updating the tabindex value when the visual order of elements change, because they are unfamiliar with this attribute and accessibility best practices in general. Since we should aim to have the screen reader and the visual order match as much as possible, ignoring tabindex on reading-flow items does make sense. What I am unsure about is the second part of the proposal:
I would argue that this change would be more confusing to the users, since most people are not familiar with the concept of focus scope owners. They would expect the HTML tabindex attribute to work across the document and would find this restriction weird. For example, should we visit all elements with tabindex=2 together?
I think there are too many possibilities for complexity. Considering the existing limitations with positive tabindex, I would prefer not making reading flow items focus scope owner and instead make their descendants also ignore tabindex. |
I take back my objection above. I looked for existing web developer feedback and there are no existing issues asking to use tabIndex weirdly like in the example above. Instead, what I see most is people setting the same tabIndex on grid/flex item and its descendants so they can have a behavior similar to reading-flow. We are adding complexity, but it can be easily documented through HTML standard and will overall be more intuitive. The current proposal is good because the CSS reading-flow property was always meant to only affect the reading flow items, not its descendants. I expand more on my research and how to change the spec here. High level, here is how this proposal changes the specification: A reading flow scope owner can be one of 3 cases:
Elements in reading flow container scope owner follows a reading-flow focus navigation scope. This takes the layout order into account to re-order the reading flow items. If a reading flow item has a positive tabindex, set it to 0. Edit: Updated the example with different tabindex values Here, the focus order is: |
During the joint CSSWG+HTML meeting, we discussed this issue again. I would like to summarize the concerns here and share my thoughts. @fantasai was advocating that setting the reading-flow value should have the same behavior as if it is not set IF the source and visual order are the same. That is currently not true because a container with reading-flow set will create focus navigation scopes (as described in this issue). Having this side effect feels off. Here is an illustration: Without reading-flow set, the order would be: t1, t2, t3. I believe the proposal of having reading flow create focus navigation scopes (which scopes tabindex) is the right approach because:
Overall it feels off (it did for me too, see comment 2 and 3 above!). But I do think this proposal is clean and will be easier/intuitive to use and maintain. ccing @tabatkins @annevk @mfreed7 for their input |
Could we Agenda+ this to be resolved at the next WHATNOT meeting? |
Done. Your preferred resolution is no change from the existing PR's behavior, right? |
Correct, my proposal is to keep the existing spec-ed behavior in this issue's fist comment: #10642 (comment). |
@tabatkins wrote:
For the last several decades, the generally regarded accessibility advice re: tabindex has been to avoid values greater than 0. A few non-exhaustive instances of that advice:
Using an even simpler version of @dizhang168's markup from above… (w/o the separately focusable, unlabeled container divs) <div class="box" id="w">
<div id="A" tabindex="0" style="order: 3">
<button tabindex="1">Item A1</button>
<button tabindex="2">Item A2</button>
</div>
<div id="B">
<button tabindex="1">Item B1</button>
<button tabindex="2">Item B2</button>
</div>
<div id="C">
<button tabindex="1">Item C1</button>
<button tabindex="2">Item C2</button>
</div>
</div> …the default behavior (before any browser change) would result in this highly illogical tab order in all existing browsers. Not really backwards compatible.
@dizhang168 wrote:
I agree with this part 👆(at least not automatically scoping.)
…but I don't make the jump to the same conclusion. 👆 At a minimum, I would NOT want browsers to ignore tabindex values of 0 or -1. There are a number of other possibilities to consider.
Probably more possibilities we haven't considered. |
Hi! Thank you for sharing your accessibility expertise. Some of the quoted bits of your comment come from before we resolved on Tab’s proposal: #10642 (comment) - I’ll try to clarify those below. The current design is to only ignore positive tabindex ( > 0) on the reading flow items. A reading flow item is a focus scope owner and its descendants will be traversed in a tabindex-ordered focus navigation scope, where tabindex will take effect.
Yes, that is the proposal. But only on the reading flow items, not its descendants.
Correct me if I’m wrong, but it seems like the general concern you have is about fallback behavior, in browsers that don’t yet support the reading-flow feature. Is that correct? If so, I agree that this is something developers will need to think about, but it seems like sites can add @supports blocks containing the styles that should be used when reading-flow is supported, and then add JavaScript code to detect a lack of support and insert tabindex attributes on the appropriate elements to “fix up” the tab navigation order appropriately.. Further, note that there is a new CSS reading-order property added to the spec. It works similarly to tabindex, overwriting the natural reading-flow order of the reading flow items, but is also understood by the accessibility tree.
I agree, the goal here is not to solve tabindex, but instead solve reading-flow without needing to depend on tabindex. However, given how focus navigation is written in the HTML spec, it is impossible for us to not define reading-flow in the context of an overall tabindex-ordered world. |
What is the issue with the HTML Standard?
Currently, the reading-flow PR has the behavior that 'reading-flow' makes the element a scope container for
tabindex
, and within that scope, tabindex ordering is consulted first, with visual-order giving tiebreaking between identical values. (I think that's a correct summary of the current behavior?)During the CSS/WHATWG joint session at TPAC, we concluded that it would be better to make
tabindex
more subordinate to 'reading-flow'.The exact proposed behavior is:
tabindex
's ordering behavior is scoped to that reading flow item subtree. (Aka the reading flow items are scope containers fortabindex
, like the spec currently defines for the "reading flow container".)The participants in the discussion believed this has a more predictable and desirable behavior for authors. Ignoring tabindex's ordering effects on the reading order items themselves seems useful; it allows authors to use tabindex to define one particular ordering, in particular a non-visual one (or one for legacy UAs), and then let 'reading-flow' override that in other cases.
Similarly, having each item be a scope for their descendant tabindexes seemed to better match the mental model we were working with, where 'reading-flow' effectively rearranges the reading order items.
The text was updated successfully, but these errors were encountered: