Open TahaTesser opened 1 year ago
Thanks for the detailed report, Taha! This issue is reproducible on the latest stable
and master
channels.
It would be great if it also supports navigating to boundary items (top/bottom) by combination keys (Cmd + Up/Down) as well.
cc @justinmc from triage.
@gspencergoog Weren't we talking about this at some point? I remember brainstorming with you how to keep a TextField focused while some buttons also have focus. Do you know if that's currently possible?
Yes, I think so, I added the ability to supply a parentNode
to the Focus
widget, which should allow you to make the focus nodes in the toolbar be descendants of the text field, meaning that the focus tree doesn't match the widget tree, but If they're focused, the text field will still think it has focus.
@gspencergoog That seems to be exactly what I need, but I just tried it and the problem I'm having is that Shortcuts traversals always seem to start from the parent Focus
.
This is a simplified version of the problem at hand, where the top Focus would be the EditableText and the bottom would be the context menu.
Is this desired or a bug? I want to be able to receive key events from the child Focus.
Yeah, because by specifying the parent node, you're bypassing the focus node that is embedded in the middle CallbackShortcuts
widget. You've restructured the focus tree so that it is a second leaf node under the focusTopNode
node.
Try printing the focus tree with debugDumpFocusTree()
and you'll see what I mean.
What you probably want to do is wrap the subtree with a Focus
widget that has the parentNode
set, but is unfocusable and not traversable, to act as a bridge to the parent. Then all the children will find that Focus
widget and parent from it.
The triaged-desktop
label is irrelevant if there is no team-desktop
label or fyi-desktop
label.
Is there an existing issue for this?
Steps to reproduce
Expected results
Be able to navigate the desktop text selection toolbar with a keyboard.
Actual results
When trying to navigate with a keyboard, the toolbar changes, and is unable to navigate with a keyboard.
Code sample
Code sample
```dart import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData(useMaterial3: true), home: const Example(), ); } } class Example extends StatelessWidget { const Example({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('DesktopTextSelectionToolbar'), ), body: const Center( child: TextField( style: TextStyle(fontSize: 24.0), ), ), ); } } ```Screenshots or Video
macOS (Keyboard navigation when hovering the toolbar)
https://user-images.githubusercontent.com/48603081/234251221-27e1069c-6048-4e3e-b59c-2d3e49a798e2.mov
Flutter (Keyboard navigation when not hovered)
https://user-images.githubusercontent.com/48603081/234251250-405298b1-c27a-4af0-a55c-9bd86eb6fa33.mov
macOS (Keyboard navigation when not hovering the toolbar)
https://user-images.githubusercontent.com/48603081/234251337-aa91ec3c-1cff-40b1-9808-86c313927da1.mov
Flutter (Keyboard navigation when not hovering the toolbar)
https://user-images.githubusercontent.com/48603081/234251394-003f22d2-c66e-4b87-9c1f-8a7773371da6.mov
Logs
Logs
```console [Paste your logs here] ```Flutter Doctor output
Doctor output
```console [!] Flutter (Channel master, 3.10.0-12.0.pre.50, on macOS 13.3.1 22E261 darwin-arm64, locale en-EE) • Flutter version 3.10.0-12.0.pre.50 on channel master at /Users/tahatesser/Code/flutter ! Upstream repository git@github.com:TahaTesser/flutter.git is not the same as FLUTTER_GIT_URL • FLUTTER_GIT_URL = git@github.com:NevercodeHQ/flutter.git • Framework revision 8395a2b2a1 (3 hours ago), 2023-04-25 04:00:07 -0400 • Engine revision a26a479e86 • Dart version 3.1.0 (build 3.1.0-38.0.dev) • DevTools version 2.23.1 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at /Users/tahatesser/Code/android-sdk • Platform android-33, build-tools 33.0.2 • ANDROID_SDK_ROOT = /Users/tahatesser/Code/android-sdk • Java binary at: /Applications/Android Studio Preview.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b653.34-9746777) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E222b • CocoaPods version 1.12.0 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio • Android Studio at /Applications/Android Studio Preview.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b653.34-9746777) [✓] VS Code (version 1.77.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.62.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E261 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 112.0.5615.137 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. ```