Skip to content
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

[Focus] Add run key command to dump the focus tree #123473

Merged
merged 2 commits into from Mar 28, 2023

Conversation

loic-sharma
Copy link
Member

@loic-sharma loic-sharma commented Mar 25, 2023

Adds a Flutter run key to dump the focus tree: once the app is launched using flutter run, pressing f dumps the focus tree. This aligns with how pressing w dumps the widget hierarchy and t dumps the render tree.

This makes it easier to debug focus issues like:

  • What is focused currently?
  • Why is tabbing moving my focus unexpectedly?
  • Why isn't my shortcut's action running?

Example output:

> flutter run lib\empty.dart -d windows
Launching lib\empty.dart on Windows in debug mode...
Building Windows application...                                     5.4s
✓  Built build\windows\runner\Debug\ui.exe.
Syncing files to device Windows...                                  66ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on Windows is available at: http://127.0.0.1:49880/aAvLj-OYB2c=/
The Flutter DevTools debugger and profiler on Windows is available at:
http://127.0.0.1:9102?uri=http://127.0.0.1:49880/aAvLj-OYB2c=/

Then when you press f:


FocusManager#59e1c
 └─rootScope: FocusScopeNode#8b67c(Root Focus Scope)

Part of #118536

Screen recording

dump_focus_tree

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added framework flutter/packages/flutter repository. See also f: labels. team Infra upgrades, team productivity, code health, technical debt. See also team: labels. tool Affects the "flutter" command-line tool. See also t: labels. labels Mar 25, 2023
@loic-sharma loic-sharma marked this pull request as ready for review March 25, 2023 21:26
Copy link
Contributor

@gspencergoog gspencergoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

Looks great, thanks!

packages/flutter/lib/src/widgets/service_extensions.dart Outdated Show resolved Hide resolved
Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@loic-sharma loic-sharma added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 28, 2023
@auto-submit auto-submit bot merged commit 8f62e34 into flutter:master Mar 28, 2023
138 checks passed
@loic-sharma loic-sharma deleted the focus_dump branch March 28, 2023 00:33
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels. team Infra upgrades, team productivity, code health, technical debt. See also team: labels. tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants