DropdownMenu should manage its own internal FocusNode when focusNode is not provided
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
## Proposal
`DropdownMenu` should adopt the `_effectiveFocusNode` pattern (already used in `TextField` and other widgets) so that it always has a `FocusNode` available internally, even when the `focusNode` parameter is not provided.
## Motivation
This change is needed to support the `resetOnBlur` feature proposed in #180584. The `resetOnBlur` implementation requires listening to focus changes, but currently `DropdownMenu` only has access to a `FocusNode` when one is explicitly provided via the `focusNode` parameter. This forces developers to always provide a `focusNode` to use `resetOnBlur`, which is an unreasonable API limitation.
By managing an internal `FocusNode` when one is not provided, `DropdownMenu` will always have a focus node to listen to, removing this restriction.
Contributor guide
Research direction
Start with the DropdownMenu implementation and compare its focus handling with the _effectiveFocusNode pattern already used in TextField and other widgets. The change is done when DropdownMenu has an internal FocusNode whenever focusNode is omitted, while still supporting a provided node for the resetOnBlur work described in #180584; check linked pull request #183684 before starting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100