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

AUTO_FOCUS has no effect in most cases #2578

Closed
willmcgugan opened this issue May 16, 2023 · 8 comments · Fixed by #2581
Closed

AUTO_FOCUS has no effect in most cases #2578

willmcgugan opened this issue May 16, 2023 · 8 comments · Fixed by #2581
Assignees
Labels
enhancement New feature or request

Comments

@willmcgugan
Copy link
Collaborator

Testing with modal02.py in /docs/examples/guide/screens AUTO_FOCUS doesn't appear to work.

Looking at the code, there doesn't appear to be any check that the thing being auto focused is actually focusable. Suspect it is trying to focus some unrelated widget.

@willmcgugan
Copy link
Collaborator Author

@rodrigogiraoserrao one for you I think

@willmcgugan willmcgugan changed the title AUTO_FOCUS doesn't work AUTO_FOCUS has no effect in most cases May 16, 2023
@rodrigogiraoserrao
Copy link
Contributor

So we should go over the query results and focus the first thing that is matched by the query and that is focusable, right?
That would be the idea?

@rodrigogiraoserrao rodrigogiraoserrao self-assigned this May 16, 2023
@rodrigogiraoserrao rodrigogiraoserrao added the enhancement New feature or request label May 16, 2023
@willmcgugan
Copy link
Collaborator Author

Exactly.

@rodrigogiraoserrao
Copy link
Contributor

AH
This was why AUTO_FOCUS didn't break tests before.

@willmcgugan
Copy link
Collaborator Author

Yeah, makes sense now.

We could take the easy route of making AUTO_FOCUS default to None

@willmcgugan
Copy link
Collaborator Author

Or we just fix the tests. Yeah, lets just fix the tests.

@rodrigogiraoserrao
Copy link
Contributor

Or we just fix the tests. Yeah, lets just fix the tests.

I'm already fixing the tests o7

@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants