Skip to content

Rename ALLOW_SELECT to clarify text selection? #5771

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

Open
TomJGooding opened this issue Apr 26, 2025 · 3 comments
Open

Rename ALLOW_SELECT to clarify text selection? #5771

TomJGooding opened this issue Apr 26, 2025 · 3 comments

Comments

@TomJGooding
Copy link
Contributor

I think ALLOW_SELECT is a confusing name, as it implies selecting the widget itself rather than just its text.

Obviously this would be a breaking change, but I think worth clarifying that this relates to text selection.

Copy link

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@willmcgugan
Copy link
Collaborator

I guess it could be ALLOW_TEXT_SELECTION, but you are still going to need to read the docstring to understand it.

Doesn't the docstring make it clear?

"""Does this widget support automatic text selection? May be further refined with [Widget.allow_select][textual.widget.Widget.allow_select]"""

@TomJGooding
Copy link
Contributor Author

I guess it could be ALLOW_TEXT_SELECTION, but you are still going to need to read the docstring to understand it.

I'm not sure the docstring really adds much apart from saying it is "automatic"?

For some context, I thought it worth raising this issue following #5770. It just seems confusing setting ALLOW_SELECT = False for buttons and other Textual widgets, as the name implies selecting the widget rather than just its text. There is also the allow_focus method which I think makes allow_select a more confusing name.

But perhaps that's just me. Obviously its entirely up to you and I appreciate this would be a breaking change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants