Skip to content

Notify Flutter inspector when navigating widget tree with keyboard#9810

Open
muhammadkamel wants to merge 1 commit intoflutter:masterfrom
muhammadkamel:fix-inspector-keyboard-selection-notify
Open

Notify Flutter inspector when navigating widget tree with keyboard#9810
muhammadkamel wants to merge 1 commit intoflutter:masterfrom
muhammadkamel:fix-inspector-keyboard-selection-notify

Conversation

@muhammadkamel
Copy link
Copy Markdown

Fixes #9809

This PR updates keyboard navigation in the Inspector widget tree so that moving selection with the up/down arrow keys notifies the Flutter inspector, matching the behavior of selecting a widget with the mouse.

Previously, keyboard navigation updated the selected row in DevTools but did not notify the connected Flutter app. Now setSelectedNode is called with notifyFlutterInspector: true during keyboard navigation, so the selected widget is reflected in the running app as expected.

Added tests for both direct controller navigation and keyboard event navigation.

Tested with:

/Users/mohammadkamel/otlob.tech/flutter_fork/bin/flutter test test/screens/inspector/inspector_tree_test.dart

Result: 8 passed.

No before/after screenshots are included because this change does not alter the visual UI; it fixes keyboard interaction behavior.

Pre-launch Checklist

General 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 the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I updated/added relevant documentation (doc comments with ///).

Issues checklist

  • I listed at least one issue that this PR fixes in the description above.
  • I listed at least one issue which has the contributions-welcome or good-first-issue label.
  • I did not list at least one issue with the contributions-welcome or good-first-issue label. I understand this means my PR might take longer to be reviewed.

Tests checklist

  • I added new tests to check the change I am making...
  • OR there is a reason for not adding tests, which I explained in the PR description.

AI-tooling checklist

  • I did not use any AI tooling in creating this PR.
  • OR I did use AI tooling, and...
    • I read the AI contributions guidelines and agree to follow them.
    • I reviewed all AI-generated code before opening this PR.
    • I understand and am able to discuss the code in this PR.
    • I have verified the accuracy of any AI-generated text included in the PR description.
    • I commit to verifying the accuracy of any AI-generated code or text that I upload in response to review comments.

Feature-change checklist

  • This PR does not change the DevTools UI or behavior and...
    • I added the release-notes-not-required label or left a comment requesting the label be added.
  • OR this PR does change the DevTools UI or behavior and...
    • I added an entry to packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.
    • I included before/after screenshots and/or a GIF demo of the new UI to my PR description.
    • I ran the DevTools app locally to manually verify my changes.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 28, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the InspectorTreeController to notify the Flutter inspector during keyboard navigation and adds corresponding widget tests. Feedback suggests optimizing the tree refresh logic by returning the result of the selection update to avoid unnecessary refreshes and refactoring duplicate helper functions in the test file to adhere to DRY principles.

Comment thread packages/devtools_app/lib/src/screens/inspector/inspector_tree_controller.dart Outdated
Comment thread packages/devtools_app/test/screens/inspector/inspector_tree_test.dart Outdated
@muhammadkamel muhammadkamel force-pushed the fix-inspector-keyboard-selection-notify branch from df61e77 to be048b4 Compare April 28, 2026 22:45
@muhammadkamel muhammadkamel force-pushed the fix-inspector-keyboard-selection-notify branch from be048b4 to 015e2ba Compare April 28, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inspector keyboard navigation does not update selected widget in app

1 participant