You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
The text was updated successfully, but these errors were encountered:
As an unrelated aside, it also would be nice to be able to specify the "default action" to perform if the enter key is pressed when a modal ContentDialog is shown. Maybe that would be an optional callback for the ContentDialog widget? Right now I'm wrapping the ContentDialog in a RawKeyboardListener, but that isn't quite right as it receives keyboard events anytime a key is pressed no matter what control has the focus (e.g., it receives all key presses for keys typed into a text box on a modal dialog), it should really only be capturing events like the enter key if another control doesn't have the focus right now. In any case, this is a common pattern for a desktop app to have some behavior when an enter key is pressed to attempt to perform a default action when a modal dialog is being shown. (Note that the ESC key already seems to work to close the dialog by asking the Navigator to pop)
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 thewidget.onSelected
andwidget.onChanged
callbacks are called during theonSelected
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 theonSelected
oronChanged
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:
The text was updated successfully, but these errors were encountered: