Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to auto focus the first thing on a screen. #2457

Closed
willmcgugan opened this issue May 2, 2023 · 2 comments · Fixed by #2527
Closed

Add option to auto focus the first thing on a screen. #2457

willmcgugan opened this issue May 2, 2023 · 2 comments · Fixed by #2527
Assignees
Labels
enhancement New feature or request Task

Comments

@willmcgugan
Copy link
Collaborator

willmcgugan commented May 2, 2023

I'm thinking that screen could grow a auto_focus parameter which takes a selector. It would then focus the first matching node, if there is one.

This would need to be done when the screen is first made active, and when it is resumed. i.e. if a screen is popped off the stack, the new one should focus.

auto_focus should be "*" by default to focus the first focusable thing. auto_focus may be set to None to disable auto focus.

@willmcgugan willmcgugan changed the title Add option, possibly the default, to auto focus the first thing on a screen. Add option to auto focus the first thing on a screen. May 2, 2023
@davep davep added enhancement New feature or request Task labels May 2, 2023
@rodrigogiraoserrao rodrigogiraoserrao self-assigned this May 9, 2023
@rodrigogiraoserrao
Copy link
Contributor

rodrigogiraoserrao commented May 9, 2023

For the case where there's a stack with 2+ screens, when we pop a screen and we go back to a previous screen, I think we should preserve the widget that was already focused previously.

@github-actions
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants