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 a base disabled property to the Textual widget hierarchy #1748

Closed
davep opened this issue Feb 9, 2023 · 2 comments · Fixed by #1785
Closed

Add a base disabled property to the Textual widget hierarchy #1748

davep opened this issue Feb 9, 2023 · 2 comments · Fixed by #1785
Assignees
Labels
enhancement New feature or request Task

Comments

@davep
Copy link
Contributor

davep commented Feb 9, 2023

In most widget frameworks that have come before, it's been very common to have a disabled property for all types of widgets, especially those that can receive focus and which the user interacts with; it's also not uncommon for a container widget to have the same and disabling it will result in all children been disabled.

Currently Textual only has disabled on Button. There are component classes of a similar name in Input but it appears no code has even been added to make use of them and an Input can't currently be disabled.

This issue proposes that disabled be added as a core property of all Textual widgets, even those that can't directly receive focus. Reasoning being:

  • Container widgets that can't receive focus, but may have children that can, should cause all their children to be disabled if the container is disabled.
  • There should be a consistent styling language for disabled widgets.
  • There should be a new :disabled pseudo class in CSS.
  • All existing widgets should get revisit to take these changes into account.
  • All future widgets should be created with disabled state in mind.

This should ideally be done before #1725.

@davep
Copy link
Contributor Author

davep commented Feb 9, 2023

Note to self: once done this will also resolve #1679.

davep added a commit to davep/textual that referenced this issue Feb 13, 2023
This seems to be a hangover from the early days of the development of
`Input`, and the styles do nothing as there's nothing else in the `Input`
code that makes use of the class that's involved.

Removed in anticipation of Textualize#1748 taking care of this.
davep added a commit to davep/textual-sandbox that referenced this issue Feb 13, 2023
davep added a commit to davep/textual that referenced this issue Feb 13, 2023
This doesn't go close to what Textualize#1748 is intending to do, but moves `disabled`
to where I want it and keeps `Button` working as before.
@davep davep linked a pull request Feb 14, 2023 that will close this issue
@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.

1 participant