-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Clarify the sequential focusing behaviour when the current focused element is not in the sequential navigation order #9081
Comments
@past I'd like to nominate this issue for the next triage meeting #9070 This is blocking against fixing this interop-2023 test case on Gecko. Thank you. |
This logic is from here: |
It looks like the test was added here: https://chromium.googlesource.com/chromium/src/+/891ceec45f09bcc6664ad1fcb0684e16f7a3d053 |
So my investigation of that interop testcase leads to this issue and I think they are related, having this issue clarified can help us to determine the correct fix for that interop testcase. Here's me trying to break down the spec:
The confusing part is what does I know the behaviour is consistent between Chrome and Safari, so I am not too confident about my breakdown, However I am also not sure what I am missing. |
I think your breakdown is correct.
I am 80% sure the intention here is to use DOM tree order. (Unclear on the intended behavior when there are shadow trees...) Because we are in the DOM case. The result is null, then: there is no element at all following starting point in the DOM. So I think continuing on with the calling algorithm, we should unfocus the starting point and focus the browser UI (step 8). Which is not what any browsers do? But does seem logical to me... Hmm. If we decide to stick with the current spec, we should definitely clarity it to use well-defined terms like tree order. (Shadow-including tree order?) And in general there's some ways we could improve clarity in these algorithms. But I'll hold off on that until we have a consensus on the desired algorithm... |
I think we prefer DOM tree order that makes the most intuitive sense. So it should focus first element in DOM tree order for this example which is |
DOM tree order makes sense, but the point is that once you reach the end of DOM tree order when tabbing, you need to focus browser UI, per step 8. (This is normally how tab-focusing works.) So I don't think we should skip that and wrap back around to the placeholder=a element. |
I think Firefox's behavior makes the most sense and is what I'd expect as a user. The DOM position of the tabindex=-1 element doesn't matter since it's not in the tab sequence. For example, if the user clicks somewhere on a page and happens to click on a focusable tabindex=-1 element, and then press tab, they probably want to interact with the page rather than the browser UI. |
I think that depends, doesn't it? If they click somewhere near the top of the page, then press tab, they probably want to focus the next sequential-focusable one after that click point, i.e. something close by, probably still near the top. But if they click somewhere near the bottom of the page, then pressing tab to focus the browser UI makes sense, since the browser UI is always "between" the bottom of the page and the top of the page in the tab cycle. |
@annevk do you have an opinion on this? |
What @domenic suggests makes sense to me. There's no reason for focus to go backwards and we don't have a special "don't go via browser UI" heuristic (although browsers are allowed to offer that of course). (Unfortunately the clicking doesn't work as expected, e.g., if I click between the controls on cc @rniwa |
I agree with what @domenic suggests also. From a user's perspective, if they click near the bottom of the document, the focus should move to something after (below) that point. If there are no further tab stops, the expectation would be that it "wraps around" to the browser UI. (What's really unfortunate is that users likely also expect this when clicking in the |
(I also agree that this is what the spec seems to currently say, but unfortunately not what browsers do. However, I'm in favor of trying to align browsers with the spec, if that's possible.) |
STR:
<tab>
Firefox moves the focus to
<input tabindex=1 placeholder="a">
and Chrome moves the focus to<input tabindex=0 placeholder="b">
.Which behaviour is correct? Should this fit into the
selection mechanism is DOM + direction is forward
of https://html.spec.whatwg.org/multipage/interaction.html#sequential-navigation-search-algorithm? What doesfollowing starting point
mean?P.S. The specification around sequential focusing is hard to follow
The text was updated successfully, but these errors were encountered: