Skip to content
Discussion options

You must be logged in to vote

You're almost there with the content of your on_input_submitted. As you note, widgets have a focus method, so if want a binding to focus your Input widget you could have something like:

...
    BINDINGS = [ ..., ("i", "focus_input", "Focus Form" ) ]
...
    def action_foocus_input( self ) -> None:
        self.query_one(Input).focus()

Of course, if you end up having more than one Input on your screen you'll want to narrow it down, perhaps using an id for the Input you want to focus.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@TomJGooding
Comment options

TomJGooding Feb 7, 2023
Collaborator Author

@davep
Comment options

Answer selected by TomJGooding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants