-
Notifications
You must be signed in to change notification settings - Fork 16
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
limel-list: keyboard navigation is broken for lists with checkboxes or radio buttons (affects typeahead too) #1468
Comments
Check if this is related to using separators and/or disabled items. |
This seems to be because the of how I can't find a solid pattern to describe exactly what happens. But as you tab throw the list items, the tab index number gets changed for all items. It seems the item that is having the keyboard focus gets I actually don't think it has anything to do with having Screen.Recording.2022-01-12.at.14.38.36.movin another example (limel-menu), when the keyboard navigation gets stuck, 👇 it seems to be possible somehow to go backwards and come in again from the other side of the list (press ⬇️ after being on the last item to jump to the top-most item again) of the list to force the keyboard navigation work again. Screen.Recording.2022-01-12.at.15.10.55.mov |
That's because you're not meant to tab through the list. I think WCAG says that tab should take you to the selected item in a set, like a group of radio-buttons or a menu, or to the first item if none is selected, the next tab should move you on to the next control, not to the next item in the same set. While a set is focused, arrow-keys should move focus between items. The reason for this is that otherwise a user navigating by keyboard will have to tab their way through every single item in every table, every list, every menu, etc, etc, on the page.
Ah! Ok, yeah, that might very well be the problem. I wonder why the tabindex attribute is lost then? 🤔 |
Sorry, clumsy writing. I meant: as you go through (not tab, but arrow keys in this case).
it seems there is a logic for tabindex in limel-list. But me no understand it. |
I had a quick look again at this one. I don't entirely understand the logic for setting tab indexes on This is what I understand: It seems the problems appear specially when we have a disabled list item. When there is a disabled item, we are getting positive That means the ones that have positive values are sequentially tab-able using keyboard. The focus will go to The logic in lime-list is adding these tabindexes, and incrementally increases these numbers.
|
The keyboard navigation bug in limel-list also affects menus. You cannot fully navigate the list of items using arrow keys. Sometimes, the outlined item gets stuck and you cannot go further than that. But perhaps because limel-menu has its own private list component ( Screen.Recording.2023-09-13.at.15.31.16.mov☝️ This video is from an upcoming PR. |
The issue you are encountering is to do with putting multiple lists in the same menu (or so is my guess). The same happens in the "user menu" in the web client, where you can only arrow-navigate between the two items in the menu "header". To get to the second list you need to tab (if I recall correctly) and then you can arrow-navigate between those items instead. I think we have the same problem in menus that have fixed items, like when you have a limel-picker, and there's a create-new option at the bottom. I'm not sure if the problem described in this PR and the problem with having multiple lists in the same menu are related. My initial guess would be that they are not, but it could be that the solution for both is very closely related, even if the underlying causes are different… 🤔 |
I remember which one you mean. But this is not the same problem. There is only one list element in the menu here. We have a script in I think the idea behind it as explained here is that:
There is some more logic to it too, like when the items are radio buttons, or checkboxes etc… I don't understand how the script is set up to work. It just looks a too complicated for me. And it doesn't seem that the script works too well. In this case, the last item doesn't have a I guess the whatever script that is responsible for the arrow keys to work, require the tabindex attribute on the list items to exist and be I also noticed other issues with this script. It doesn't matter if a list item has |
@TommyLindh2 please check the script as we discussed 🙏 |
I think that script might be part of MDC, and the reason it's not working so well could be that we're doing things MDC doesn't expect. If it is indeed from MDC, perhaps we could ditch that script and write our own instead.
Do you have any source for that (the part I bolded)? I would have thought that disabled items should still be focusable, so that a non-sighted user can get the same information that a sighted user gets (there's a menu choice here, label says "blah blah", it's currently disabled). But perhaps that information is already read by the screen reader when the menu is opened? And in that case, it totally makes sense that you'd want to skip past any disabled options. Ugh… I feel like we really can't make good decisions in questions like these without at least trying things out with a screen reader 😞 I mean, even then we probably couldn't make good decisions, unless we also learned more (or at least more than I currently know) about how real users of screen readers use them. With any graphical UI, there can be things that seem great when you just click around a bit to try something out, but when you actually start using the feature, all of a sudden that behaviour that felt like a feature is now the most irritating thing in the world. I'm sure there are similar things with auditory interfaces too. |
I also used to think like you. But I also knew when you have a disabled button on the page, you cannot select it using the tab key Then I asked my enemy (Chat GPT) if this was supposed to be like that. The stupid confident robot said: Anyhow... let's ignore this part of the discussion for now. @TommyLindh2 has figured out why this keyboard navigation problem happens 🥳 and he will soon make a PR with explanations about the source. He wanted to talk to you and Johan about it. |
What!? |
I know you said to ignore this part of the discussion, but I just wanted to add a question I asked ChatGPT (with GPT-4), and the response I got: Prompt:I just now was told that if you give an element Response:Certainly! Let's break down the behavior of the
|
This is really cool, and I'm happy we went through this now. It opened up a bunch of closed doors in my head; and I realize how many accessibility problems we currently have in many of our components 🙈 I think we will open a bunch of new PRs for these. We should also enable a way of navigating clickable elements within some of our current components, like the action bar, dock, or the upcoming breadcrumbs but toggling tabindexes. We should then also allow users to navigate them using arrow-keys instead of tabbing like a maniac between the internal buttons in these components. |
Yeah, that's what MDC typically does, or tries to do 😅. If there's a collection of focusable things of some kind, a list or something, it lets you tab to the selected one, if one is selected, or the first element if none is selected (not sure if it does the first element or the first selected element if many are selected, but anyway). You can then use the arrow keys to move between the different items. I'm not sure if that actually moves the focus or just MDC's own visual highlight. But that lets you both quickly tab past a giant list, and navigate through the list. And it's probably compatible with screen readers too then… 👍 |
Made this issue to follow this up #2486 |
Current behavior
broken.checkbox.list.mov
Steps to reproduce the behavior:
space
orenter
to deselect "Pikachu".Expected behavior
The list should not lose focus when items are deselected, and all list items should always be reachable by keyboard.
Environment
The text was updated successfully, but these errors were encountered: