-
Notifications
You must be signed in to change notification settings - Fork 26.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
Directional navigation key binding defaults should be limited to those platforms that use it. #54998
Comments
I just noticed that a similar thing happens in the "flutter inspector" tab. This is without any specific key handling for the arrow keys. Focus travels through the inspector tree and other UI elements in an unpredictable way. In this example I just mouse-click on the root element and then press the up/down/left/right arrow keys to see what happens. |
Extremely unlikely; it's almost certainly this code. Note that macOS and web have different defaults. @gspencergoog would have more context on this. Greg, I'm not sure why arrow keys are doing control navigation on macOS by default; I can't think of any native application that has that behavior so it seems very unexpected as a default. |
I believe you can turn it off per #45102, but absent a strong argument in favor of having them, I think the right fix here is to have these not be part of the default set on desktop. |
You're right, I think these are probably not correct for macOS. I'll disable them. I did look into the user interface guidelines for keyboard traversal on macOS at the time I defined those, but I didn't find guidance that was all that helpful there one way or another. |
When you disable them for macOS, maybe refactor a bit to have _defaultDesktopShortcuts, so that we don't have the same bug crop up for Linux and Windows? We can always re-specialize them later if we find places we want to diverge. |
Linux (Debian) at least (I can't test windows at the moment) does do this kind of navigation, at least in their system settings app and a couple of others I tested. |
I'm seeing some control-specific things on Windows (e.g., if I'm in a list, or in a menu, then it navigates within that context, as on macOS), but nothing that jumps to other control areas. |
Actually, just disabling it won't work. I'm going to need to disable it at the top level, and then add it back in for each of the things that should be able to navigate in that way (e.g. for a list view, you should be able to navigate in the scroll axis). |
@gspencergoog Ah. This only partially helps me, since both my widgets are rendered in ListViews. Is there a way to control key navigation at that level? https://github.com/flutter/devtools/blob/6d9cd23f61c3bd98a32d84acbce0d25968b49021/packages/devtools_app/lib/src/flutter/table.dart#L661 |
You can always just turn it off, or bind it to another action. To turn it off, you can put a |
Or, if you want to turn off directional navigation, but don't want to know the keys it is bound to, you can also bind a |
We want to handle key navigation ourselves, and Listbox expects arrow key navigation to work on list elements, which creates a conflict. There is some discussion of the behavior here: flutter/flutter#54998 Also, since flutter#1899 autofocus is working which allowed me to remove a couple tap-to-focus callbacks.
Is this still valid? |
Yes, this is still valid. |
The |
When running the fluter devtools on macos, I'm seeing strange key handling behavior. There are extra key actions that I don't see on flutter web. Some discussion of the issue, with screenshots, is at flutter/devtools#1769. But essentially:
I'm adding row selection and keyboard navigation to a custom widget TreeTable (built here). I'm explicitly handling the arrow up/down keys to move the selection and scroll the view. But on macos I see scrolling that is not caused by my handler, and also a kind of ghost selected row (see the screenshots in flutter/devtools#1769) not caused by me (the color is different than the one I am using). Also, sometimes after clicking on a row the arrow keys will start cycling through the top-level tabs (Inspector, timeline) instead of the rows in the table.
In a nutshell there is some code handling the up/down arrow keys in a way that I don't understand, can't control, and can't predict. It also does not happen when I run via flutter web which leads me to believe it's a bug in the macos platform code.
The PR that introduced keyboard navigation is here: flutter/devtools#1810
Steps to Reproduce
$git clone git@github.com:flutter/devtools.git
$cd devtools/packages/devtools_app
$flutter run -d macos
-d web
Expected results:
I expect the arrow up/down keys to cause the window to scroll only when the selection reaches the bottom or top of the viewport. I expect there to be only 1 selected row. I expect that pressing the arrow up/down keys should not escape the treetable and start cycling the top-level tabs of the viewport.
Actual results:
See the examples at flutter/devtools#1769
Logs
The text was updated successfully, but these errors were encountered: