Skip to content

Conversation

@AhmedLSayed9
Copy link
Contributor

fixes #166642

The newly added tests verify the following behaviors:

  1. DropdownButtonFormField can be focused if it was unfocused and we replaced FocusNode.
  2. DropdownButtonFormField can be unfocused if it was focused and we replaced FocusNode.

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].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Apr 5, 2025
@dkwingsmt dkwingsmt requested a review from justinmc April 9, 2025 18:25
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

Thanks for jumping in to fix this! I think I see a possible leak, see my comment below. Otherwise this looks good.

Comment on lines 1360 to 1388
if (widget.focusNode == null) {
_internalNode ??= _createFocusNode();
if (widget.focusNode != oldWidget.focusNode) {
oldWidget.focusNode?.removeListener(_handleFocusChanged);
if (widget.focusNode == null) {
_internalNode ??= _createFocusNode();
}
_hasPrimaryFocus = focusNode.hasPrimaryFocus;
focusNode.addListener(_handleFocusChanged);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it might be possible for _internalNode to leak a listener. Consider if oldWidget had no focusNode, so it created an _internalNode in initState. Then here there is a widget.focusNode. We should call _internalNode.removeListener, but it looks like we don't.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you write a test that covers this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I've handled that case.

I can't find a way to test it, since:

  • FocusNode mixes in ChangeNotifier but its hasListeners getter is marked as @Protected
  • The _handleFocusChanged callback doesn't affect anything anyway when leaked

Copy link
Contributor

Choose a reason for hiding this comment

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

We have some automatic leak detection that might catch this. You can run it like:

flutter test --dart-define LEAK_TRACKING=true <path/to/test.dart>

So I think if you just write a test that covers this case it's good enough, even if you can't directly verify that a leak didn't happen. Assuming we don't already have a test that covers this, I would do something like:

  • Build a DropdownButtonFormField wrapped in a StatefulBuilder with some boolean to decide whether to pass a focusNode. Start off with no focusNode.
  • Maybe expect that it uses focusColor when focused or something.
  • Call change your boolean and call setState so it rebuilds and now has no focusNode.
  • Expect the focusColor thing again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Running the test with LEAK_TRACKING=true revealed that a FocusNode is still leaking due to not being properly disposed. I found that we should therefore fully dispose _internalNode rather than just removing the listener.

Interestingly, running the test with or without disposing _internalNode doesn't trigger a leak warning. The warning only appears when we remove the listener without disposing the focus node.

Given that we're now disposing the internal focus node, we can write a more relevant test to cover that, by calling the dispose method again and verifying that it throws an error.

@AhmedLSayed9 AhmedLSayed9 requested a review from justinmc April 18, 2025 22:11
@AhmedLSayed9 AhmedLSayed9 force-pushed the fix_dropdown_focus_node_replace branch from 88c52a5 to 900ed72 Compare April 18, 2025 22:15
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

Two possible changes to make in my two comments, otherwise good. Thanks for the quick response!

Comment on lines 1360 to 1388
if (widget.focusNode == null) {
_internalNode ??= _createFocusNode();
if (widget.focusNode != oldWidget.focusNode) {
oldWidget.focusNode?.removeListener(_handleFocusChanged);
if (widget.focusNode == null) {
_internalNode ??= _createFocusNode();
}
_hasPrimaryFocus = focusNode.hasPrimaryFocus;
focusNode.addListener(_handleFocusChanged);
Copy link
Contributor

Choose a reason for hiding this comment

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

We have some automatic leak detection that might catch this. You can run it like:

flutter test --dart-define LEAK_TRACKING=true <path/to/test.dart>

So I think if you just write a test that covers this case it's good enough, even if you can't directly verify that a leak didn't happen. Assuming we don't already have a test that covers this, I would do something like:

  • Build a DropdownButtonFormField wrapped in a StatefulBuilder with some boolean to decide whether to pass a focusNode. Start off with no focusNode.
  • Maybe expect that it uses focusColor when focused or something.
  • Call change your boolean and call setState so it rebuilds and now has no focusNode.
  • Expect the focusColor thing again.

@AhmedLSayed9 AhmedLSayed9 requested a review from justinmc April 19, 2025 04:51
@justinmc
Copy link
Contributor

Can you fix the analyzer failure here?

@AhmedLSayed9 AhmedLSayed9 force-pushed the fix_dropdown_focus_node_replace branch from f70f155 to 94698c7 Compare April 21, 2025 22:05
@AhmedLSayed9
Copy link
Contributor Author

Can you fix the analyzer failure here?

All good now.

Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, one question about the tests.

focusNode.requestFocus();

await tester.pumpWidget(buildFormField());
await tester.pump(); // Wait for requestFocus to take effect.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for including the comment here.

Comment on lines +2607 to +2608
focusNode = FocusNode(debugLabel: 'DropdownButtonFormField');
focusNode.requestFocus();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused by this, why do you create a new FocusNode and not use it anywhere? The widget created by buildFormField will not have a reference to this new FocusNode right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't create a new FocusNode variable, it replaces the value of the existing focusNode variable which is used by buildFormField. The focusNode declared at the start of the test is a mutable variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@justinmc
This is just a reminder, in case you've missed my reply :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, thanks for the reminder here. You're right that it will get picked up when buildFormField is called below, looks good 👍

Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

LGTM 👍. Thanks for following through on this PR! I will look for a secondary reviewer.

Comment on lines +2607 to +2608
focusNode = FocusNode(debugLabel: 'DropdownButtonFormField');
focusNode.requestFocus();
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, thanks for the reminder here. You're right that it will get picked up when buildFormField is called below, looks good 👍

Copy link
Contributor

@bleroux bleroux left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for your contribution 🙏

@bleroux bleroux force-pushed the fix_dropdown_focus_node_replace branch from 94698c7 to 66e04cc Compare May 13, 2025 05:04
@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 11, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Jun 11, 2025
Merged via the queue into flutter:master with commit 064f6d1 Jun 11, 2025
76 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 11, 2025
@jonahwilliams
Copy link
Contributor

reason for revert: multiple test failures w/ dropdown buttons - https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20framework_tests_libraries/22946/overview

@jonahwilliams jonahwilliams added the revert Autorevert PR (with "Reason for revert:" comment) label Jun 11, 2025
auto-submit bot pushed a commit that referenced this pull request Jun 11, 2025
@auto-submit auto-submit bot removed the revert Autorevert PR (with "Reason for revert:" comment) label Jun 11, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jun 11, 2025
#166645)" (#170477)

<!-- start_original_pr_link -->
Reverts: #166645
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: jonahwilliams
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: multiple test failures w/ dropdown buttons -
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20framework_tests_libraries/22946/overview
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: AhmedLSayed9
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {bleroux, justinmc}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
fixes #166642

**The newly added tests verify the following behaviors:**

1. DropdownButtonFormField can be focused if it was unfocused and we
replaced FocusNode.
2. DropdownButtonFormField can be unfocused if it was focused and we
replaced FocusNode.

## Pre-launch Checklist

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

Co-authored-by: auto-submit[bot] <[email protected]>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 12, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jun 12, 2025
Roll Flutter from 824868f5d1e6 to f79452e3f4ea (94 revisions)

flutter/flutter@824868f...f79452e

2025-06-12 [email protected] Roll Skia from 38b9f9b0e496 to b41e7017658e (12 revisions) (flutter/flutter#170514)
2025-06-12 [email protected] Fix `Semantics.identifier` on TextField not working on web (flutter/flutter#170395)
2025-06-12 [email protected] Revert "[a11y] Semantics flag refactor step 2: embedder part" (flutter/flutter#170498)
2025-06-12 [email protected] Copy `packages_autoroller` to `dev/packages_autoroller/run`. (flutter/flutter#170495)
2025-06-11 [email protected] Allow the Slider to always show the value indicator. (flutter/flutter#162223)
2025-06-11 [email protected] Update master branch `CHANGELOG.md` for 3.32.3. (flutter/flutter#170492)
2025-06-11 [email protected] Add time to first frame for `Mac_arm64_ios imitation_game_swiftui` (flutter/flutter#167602)
2025-06-11 [email protected] Make `DropdownMenu` TextField reactive to label changes (flutter/flutter#162062)
2025-06-11 [email protected] Roll Dart SDK from b569246d64bc to 9f741ef8a689 (1 revision) (flutter/flutter#170473)
2025-06-11 [email protected] [impellerc] add GLES shader define. (flutter/flutter#170375)
2025-06-11 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Pause UIScene migration (#170457)" (flutter/flutter#170487)
2025-06-11 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix DropdownButtonFormField focusing when replacing FocusNode (#166645)" (flutter/flutter#170477)
2025-06-11 [email protected] Pause UIScene migration (flutter/flutter#170457)
2025-06-11 [email protected] iOS tool dylibs do not need entitlements (flutter/flutter#170448)
2025-06-11 [email protected] Adds getters for different formats of build mode name (flutter/flutter#170251)
2025-06-11 [email protected] Remove all code in `conductor/core` that is now unused (flutter/flutter#170454)
2025-06-11 [email protected] Roll Packages from 974f152 to 0b322a2 (9 revisions) (flutter/flutter#170462)
2025-06-11 [email protected] Roll Skia from b78fdc3ba26b to 38b9f9b0e496 (7 revisions) (flutter/flutter#170453)
2025-06-11 [email protected] Fix remaining iconbuttontheme overrides in listtile (flutter/flutter#169029)
2025-06-11 [email protected] Fix DropdownButtonFormField focusing when replacing FocusNode (flutter/flutter#166645)
2025-06-11 [email protected] Add CupertinoRadio widget of the week video (flutter/flutter#170027)
2025-06-11 [email protected] Docs: Update docs for suffix icon interaction behaviour (flutter/flutter#169828)
2025-06-11 [email protected] [ Widget Preview ] Don't try to load previews with compile-time errors (flutter/flutter#170262)
2025-06-11 [email protected] [canvaskit] Manually trigger `input` event in text editing tests for Safari (flutter/flutter#170022)
2025-06-11 [email protected] Tiny clean-up in triage docs (flutter/flutter#170429)
2025-06-11 [email protected] Roll pub packages (flutter/flutter#170444)
2025-06-11 [email protected] [Impeller] Avoid creating paths when rendering arcs (flutter/flutter#170398)
2025-06-11 [email protected] Fix date picker calendar tap targets (portrait mode) (flutter/flutter#169163)
2025-06-11 [email protected] Add SK_SUPPORT_UNSPANNED_APIS staging flag (flutter/flutter#170139)
2025-06-11 [email protected] Roll Dart SDK from 6290dfd1d88a to b569246d64bc (4 revisions) (flutter/flutter#170430)
2025-06-11 [email protected] Roll Skia from 910070084066 to b78fdc3ba26b (33 revisions) (flutter/flutter#170412)
2025-06-11 [email protected] Use pathops module groups (flutter/flutter#169857)
2025-06-10 [email protected] Roll pub packages (flutter/flutter#170399)
2025-06-10 [email protected] Verify old version of Python has the `lib2to3` import available (flutter/flutter#170187)
2025-06-10 [email protected] Use "flutter pub get" to resolve packages when building the docs snippets tool (flutter/flutter#170381)
2025-06-10 [email protected] [engine] Reland: ensure engines spawned from an engine using dynamic rendering selection still use the dynamic surface. (flutter/flutter#170389)
2025-06-10 [email protected] Revert "Add call to Dart_NotifyDestroyed when the flutter view is des… (flutter/flutter#170309)
2025-06-10 [email protected] fix: set versionCodeOverride when split-per-abi is specified (flutter/flutter#169816)
2025-06-10 [email protected] fix: Skip native assets build test (flaky, takes 15m+) (flutter/flutter#170383)
2025-06-10 [email protected] Marks Linux web_benchmarks_ddc to be unflaky (flutter/flutter#167631)
2025-06-10 [email protected] Marks Linux web_benchmarks_ddc_hot_reload to be unflaky (flutter/flutter#168807)
2025-06-10 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[engine] ensure engines spawned from an engine using dynamic rendering selection still use the dynamic surface. (#170313)" (flutter/flutter#170377)
2025-06-10 [email protected] [a11y] Semantics flag refactor step 2: embedder part (flutter/flutter#167738)
2025-06-10 [email protected] Roll Dart SDK from c26e7ca44805 to 6290dfd1d88a (5 revisions) (flutter/flutter#170363)
2025-06-10 [email protected] Remove `pubspec.lock` files for `flutter_tools` and `widget_preview_scaffold`. (flutter/flutter#170364)
2025-06-10 [email protected] [engine] ensure engines spawned from an engine using dynamic rendering selection still use the dynamic surface. (flutter/flutter#170313)
...
@AhmedLSayed9
Copy link
Contributor Author

reason for revert: multiple test failures w/ dropdown buttons - https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20framework_tests_libraries/22946/overview

@jonahwilliams Should I open another PR to address this, or is there something else you’d recommend I do to get this merged?

@bleroux
Copy link
Contributor

bleroux commented Jun 17, 2025

@AhmedLSayed9
Yes, please file another PR to reland your fix, there was probably a change which landed between the time you finalised your PR and the moment it was merged.
See #170476 for some context.

With this new PR we will see if all CI checks pass.

Ortes pushed a commit to Ortes/packages that referenced this pull request Jun 25, 2025
…r#9419)

Roll Flutter from 824868f5d1e6 to f79452e3f4ea (94 revisions)

flutter/flutter@824868f...f79452e

2025-06-12 [email protected] Roll Skia from 38b9f9b0e496 to b41e7017658e (12 revisions) (flutter/flutter#170514)
2025-06-12 [email protected] Fix `Semantics.identifier` on TextField not working on web (flutter/flutter#170395)
2025-06-12 [email protected] Revert "[a11y] Semantics flag refactor step 2: embedder part" (flutter/flutter#170498)
2025-06-12 [email protected] Copy `packages_autoroller` to `dev/packages_autoroller/run`. (flutter/flutter#170495)
2025-06-11 [email protected] Allow the Slider to always show the value indicator. (flutter/flutter#162223)
2025-06-11 [email protected] Update master branch `CHANGELOG.md` for 3.32.3. (flutter/flutter#170492)
2025-06-11 [email protected] Add time to first frame for `Mac_arm64_ios imitation_game_swiftui` (flutter/flutter#167602)
2025-06-11 [email protected] Make `DropdownMenu` TextField reactive to label changes (flutter/flutter#162062)
2025-06-11 [email protected] Roll Dart SDK from b569246d64bc to 9f741ef8a689 (1 revision) (flutter/flutter#170473)
2025-06-11 [email protected] [impellerc] add GLES shader define. (flutter/flutter#170375)
2025-06-11 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Pause UIScene migration (#170457)" (flutter/flutter#170487)
2025-06-11 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix DropdownButtonFormField focusing when replacing FocusNode (#166645)" (flutter/flutter#170477)
2025-06-11 [email protected] Pause UIScene migration (flutter/flutter#170457)
2025-06-11 [email protected] iOS tool dylibs do not need entitlements (flutter/flutter#170448)
2025-06-11 [email protected] Adds getters for different formats of build mode name (flutter/flutter#170251)
2025-06-11 [email protected] Remove all code in `conductor/core` that is now unused (flutter/flutter#170454)
2025-06-11 [email protected] Roll Packages from 974f152 to 0b322a2 (9 revisions) (flutter/flutter#170462)
2025-06-11 [email protected] Roll Skia from b78fdc3ba26b to 38b9f9b0e496 (7 revisions) (flutter/flutter#170453)
2025-06-11 [email protected] Fix remaining iconbuttontheme overrides in listtile (flutter/flutter#169029)
2025-06-11 [email protected] Fix DropdownButtonFormField focusing when replacing FocusNode (flutter/flutter#166645)
2025-06-11 [email protected] Add CupertinoRadio widget of the week video (flutter/flutter#170027)
2025-06-11 [email protected] Docs: Update docs for suffix icon interaction behaviour (flutter/flutter#169828)
2025-06-11 [email protected] [ Widget Preview ] Don't try to load previews with compile-time errors (flutter/flutter#170262)
2025-06-11 [email protected] [canvaskit] Manually trigger `input` event in text editing tests for Safari (flutter/flutter#170022)
2025-06-11 [email protected] Tiny clean-up in triage docs (flutter/flutter#170429)
2025-06-11 [email protected] Roll pub packages (flutter/flutter#170444)
2025-06-11 [email protected] [Impeller] Avoid creating paths when rendering arcs (flutter/flutter#170398)
2025-06-11 [email protected] Fix date picker calendar tap targets (portrait mode) (flutter/flutter#169163)
2025-06-11 [email protected] Add SK_SUPPORT_UNSPANNED_APIS staging flag (flutter/flutter#170139)
2025-06-11 [email protected] Roll Dart SDK from 6290dfd1d88a to b569246d64bc (4 revisions) (flutter/flutter#170430)
2025-06-11 [email protected] Roll Skia from 910070084066 to b78fdc3ba26b (33 revisions) (flutter/flutter#170412)
2025-06-11 [email protected] Use pathops module groups (flutter/flutter#169857)
2025-06-10 [email protected] Roll pub packages (flutter/flutter#170399)
2025-06-10 [email protected] Verify old version of Python has the `lib2to3` import available (flutter/flutter#170187)
2025-06-10 [email protected] Use "flutter pub get" to resolve packages when building the docs snippets tool (flutter/flutter#170381)
2025-06-10 [email protected] [engine] Reland: ensure engines spawned from an engine using dynamic rendering selection still use the dynamic surface. (flutter/flutter#170389)
2025-06-10 [email protected] Revert "Add call to Dart_NotifyDestroyed when the flutter view is des… (flutter/flutter#170309)
2025-06-10 [email protected] fix: set versionCodeOverride when split-per-abi is specified (flutter/flutter#169816)
2025-06-10 [email protected] fix: Skip native assets build test (flaky, takes 15m+) (flutter/flutter#170383)
2025-06-10 [email protected] Marks Linux web_benchmarks_ddc to be unflaky (flutter/flutter#167631)
2025-06-10 [email protected] Marks Linux web_benchmarks_ddc_hot_reload to be unflaky (flutter/flutter#168807)
2025-06-10 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[engine] ensure engines spawned from an engine using dynamic rendering selection still use the dynamic surface. (#170313)" (flutter/flutter#170377)
2025-06-10 [email protected] [a11y] Semantics flag refactor step 2: embedder part (flutter/flutter#167738)
2025-06-10 [email protected] Roll Dart SDK from c26e7ca44805 to 6290dfd1d88a (5 revisions) (flutter/flutter#170363)
2025-06-10 [email protected] Remove `pubspec.lock` files for `flutter_tools` and `widget_preview_scaffold`. (flutter/flutter#170364)
2025-06-10 [email protected] [engine] ensure engines spawned from an engine using dynamic rendering selection still use the dynamic surface. (flutter/flutter#170313)
...
github-merge-queue bot pushed a commit that referenced this pull request Jun 27, 2025
…FocusNode (#170761)

This is a reland of #166645

fixes #166642

**The newly added tests verify the following behaviors:**

1. DropdownButtonFormField can be focused if it was unfocused and we
replaced FocusNode.
2. DropdownButtonFormField can be unfocused if it was focused and we
replaced FocusNode.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
…r#166645)

fixes flutter#166642

**The newly added tests verify the following behaviors:**

1. DropdownButtonFormField can be focused if it was unfocused and we
replaced FocusNode.
2. DropdownButtonFormField can be unfocused if it was focused and we
replaced FocusNode.

## Pre-launch Checklist

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

---------

Co-authored-by: Tong Mu <[email protected]>
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
flutter#166645)" (flutter#170477)

<!-- start_original_pr_link -->
Reverts: flutter#166645
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: jonahwilliams
<!-- end_initiating_author -->
<!-- start_revert_reason -->
Reason for reverting: multiple test failures w/ dropdown buttons -
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20framework_tests_libraries/22946/overview
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: AhmedLSayed9
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {bleroux, justinmc}
<!-- end_reviewers -->

<!-- start_revert_body -->
This change reverts the following previous change:
fixes flutter#166642

**The newly added tests verify the following behaviors:**

1. DropdownButtonFormField can be focused if it was unfocused and we
replaced FocusNode.
2. DropdownButtonFormField can be unfocused if it was focused and we
replaced FocusNode.

## Pre-launch Checklist

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

Co-authored-by: auto-submit[bot] <[email protected]>
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
…lacing FocusNode (flutter#170761)

This is a reland of flutter#166645

fixes flutter#166642

**The newly added tests verify the following behaviors:**

1. DropdownButtonFormField can be focused if it was unfocused and we
replaced FocusNode.
2. DropdownButtonFormField can be unfocused if it was focused and we
replaced FocusNode.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
…r#9419)

Roll Flutter from 824868f5d1e6 to f79452e3f4ea (94 revisions)

flutter/flutter@824868f...f79452e

2025-06-12 [email protected] Roll Skia from 38b9f9b0e496 to b41e7017658e (12 revisions) (flutter/flutter#170514)
2025-06-12 [email protected] Fix `Semantics.identifier` on TextField not working on web (flutter/flutter#170395)
2025-06-12 [email protected] Revert "[a11y] Semantics flag refactor step 2: embedder part" (flutter/flutter#170498)
2025-06-12 [email protected] Copy `packages_autoroller` to `dev/packages_autoroller/run`. (flutter/flutter#170495)
2025-06-11 [email protected] Allow the Slider to always show the value indicator. (flutter/flutter#162223)
2025-06-11 [email protected] Update master branch `CHANGELOG.md` for 3.32.3. (flutter/flutter#170492)
2025-06-11 [email protected] Add time to first frame for `Mac_arm64_ios imitation_game_swiftui` (flutter/flutter#167602)
2025-06-11 [email protected] Make `DropdownMenu` TextField reactive to label changes (flutter/flutter#162062)
2025-06-11 [email protected] Roll Dart SDK from b569246d64bc to 9f741ef8a689 (1 revision) (flutter/flutter#170473)
2025-06-11 [email protected] [impellerc] add GLES shader define. (flutter/flutter#170375)
2025-06-11 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Pause UIScene migration (#170457)" (flutter/flutter#170487)
2025-06-11 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix DropdownButtonFormField focusing when replacing FocusNode (#166645)" (flutter/flutter#170477)
2025-06-11 [email protected] Pause UIScene migration (flutter/flutter#170457)
2025-06-11 [email protected] iOS tool dylibs do not need entitlements (flutter/flutter#170448)
2025-06-11 [email protected] Adds getters for different formats of build mode name (flutter/flutter#170251)
2025-06-11 [email protected] Remove all code in `conductor/core` that is now unused (flutter/flutter#170454)
2025-06-11 [email protected] Roll Packages from 974f152 to 0b322a2 (9 revisions) (flutter/flutter#170462)
2025-06-11 [email protected] Roll Skia from b78fdc3ba26b to 38b9f9b0e496 (7 revisions) (flutter/flutter#170453)
2025-06-11 [email protected] Fix remaining iconbuttontheme overrides in listtile (flutter/flutter#169029)
2025-06-11 [email protected] Fix DropdownButtonFormField focusing when replacing FocusNode (flutter/flutter#166645)
2025-06-11 [email protected] Add CupertinoRadio widget of the week video (flutter/flutter#170027)
2025-06-11 [email protected] Docs: Update docs for suffix icon interaction behaviour (flutter/flutter#169828)
2025-06-11 [email protected] [ Widget Preview ] Don't try to load previews with compile-time errors (flutter/flutter#170262)
2025-06-11 [email protected] [canvaskit] Manually trigger `input` event in text editing tests for Safari (flutter/flutter#170022)
2025-06-11 [email protected] Tiny clean-up in triage docs (flutter/flutter#170429)
2025-06-11 [email protected] Roll pub packages (flutter/flutter#170444)
2025-06-11 [email protected] [Impeller] Avoid creating paths when rendering arcs (flutter/flutter#170398)
2025-06-11 [email protected] Fix date picker calendar tap targets (portrait mode) (flutter/flutter#169163)
2025-06-11 [email protected] Add SK_SUPPORT_UNSPANNED_APIS staging flag (flutter/flutter#170139)
2025-06-11 [email protected] Roll Dart SDK from 6290dfd1d88a to b569246d64bc (4 revisions) (flutter/flutter#170430)
2025-06-11 [email protected] Roll Skia from 910070084066 to b78fdc3ba26b (33 revisions) (flutter/flutter#170412)
2025-06-11 [email protected] Use pathops module groups (flutter/flutter#169857)
2025-06-10 [email protected] Roll pub packages (flutter/flutter#170399)
2025-06-10 [email protected] Verify old version of Python has the `lib2to3` import available (flutter/flutter#170187)
2025-06-10 [email protected] Use "flutter pub get" to resolve packages when building the docs snippets tool (flutter/flutter#170381)
2025-06-10 [email protected] [engine] Reland: ensure engines spawned from an engine using dynamic rendering selection still use the dynamic surface. (flutter/flutter#170389)
2025-06-10 [email protected] Revert "Add call to Dart_NotifyDestroyed when the flutter view is des… (flutter/flutter#170309)
2025-06-10 [email protected] fix: set versionCodeOverride when split-per-abi is specified (flutter/flutter#169816)
2025-06-10 [email protected] fix: Skip native assets build test (flaky, takes 15m+) (flutter/flutter#170383)
2025-06-10 [email protected] Marks Linux web_benchmarks_ddc to be unflaky (flutter/flutter#167631)
2025-06-10 [email protected] Marks Linux web_benchmarks_ddc_hot_reload to be unflaky (flutter/flutter#168807)
2025-06-10 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[engine] ensure engines spawned from an engine using dynamic rendering selection still use the dynamic surface. (#170313)" (flutter/flutter#170377)
2025-06-10 [email protected] [a11y] Semantics flag refactor step 2: embedder part (flutter/flutter#167738)
2025-06-10 [email protected] Roll Dart SDK from c26e7ca44805 to 6290dfd1d88a (5 revisions) (flutter/flutter#170363)
2025-06-10 [email protected] Remove `pubspec.lock` files for `flutter_tools` and `widget_preview_scaffold`. (flutter/flutter#170364)
2025-06-10 [email protected] [engine] ensure engines spawned from an engine using dynamic rendering selection still use the dynamic surface. (flutter/flutter#170313)
...
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
…lacing FocusNode (flutter#170761)

This is a reland of flutter#166645

fixes flutter#166642

**The newly added tests verify the following behaviors:**

1. DropdownButtonFormField can be focused if it was unfocused and we
replaced FocusNode.
2. DropdownButtonFormField can be unfocused if it was focused and we
replaced FocusNode.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DropdownButtonFormField can't be focused/unfocused when replacing FocusNode

6 participants