Skip to content

Focus behavior of AutoSuggestBox #671

@klondikedragon

Description

@klondikedragon

Is your feature request related to a problem? Please describe.
I'm using the AutoSuggestBox with autofocus=true and trying to set the focus to the next control (or even a different control than the next control, e.g., like the final submit button in the form). The AutoSuggestBox is calling focusNode.unfocus(); at the end after both the widget.onSelected and widget.onChanged callbacks are called during the onSelected callback of the overlay built in the _insertOverlay() method call. This means that I can't control the focus from either of those callbacks since even if I set the focus in the onSelected or onChanged callback the later call to unfocus clears that out.

Describe the solution you'd like
I'd like to be able to control the focus myself from either of these callbacks, to set a custom focus behavior when a selection of an item has been made.

Additional context
I'm using the AutoSuggestBox as the main content in a modal ContentDialog (shown using showDialog) and I want to set focus to the Apply button when the user made a selection from the AutoSuggestBox overlay:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions