mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
<!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> Added an API to control the FocusNode of DropdownMenu Trailing IconButton. This is also an improvement to [DropdownMenu Focus](https://github.com/flutter/flutter/pull/156412/) since introducing the FocusNode to IconButton brings uniformity to the Focus Traversal. Previously there were two cases - If FocusNode is passed to DropdownMenu, 3 ```tab``` presses were required to focus the Trailing IconButton - If FocusNode is not passed then 3 ```tab``` presses were needed for MacOS, Windows & Linux Platforms and 2 for Android, iOS & Fuchsia. This PR allows Focusing the IconButton by single ```tab``` press Fixes #172687 by passing a FocusNode with ```skipTraversal:true``` ### Before - MacOS - https://github.com/user-attachments/assets/d2f6f3dd-e37c-4293-8c0e-6b73650a830b - IOS without a FocusNode - https://github.com/user-attachments/assets/4a03bb98-faac-44b6-809d-9887941972c3 - IOS with a FocusNode - https://github.com/user-attachments/assets/9f0f5e0d-6f20-4d21-af9b-52e3cb0014e5 ### After - MacOS - https://github.com/user-attachments/assets/6d9d77be-760c-43f3-b23e-cef0dbdc3f47 - IOS without FocusNode - https://github.com/user-attachments/assets/2146dd72-9464-4af4-932d-f88463e6012c - IOS with a FocusNode - https://github.com/user-attachments/assets/035ce567-838d-4ed8-943c-5b508c1fd09f ## 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. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md