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

Inconsistent treatment of overlapping markup and TCSS #3421

Closed
rodrigogiraoserrao opened this issue Sep 28, 2023 · 2 comments · Fixed by #4752
Closed

Inconsistent treatment of overlapping markup and TCSS #3421

rodrigogiraoserrao opened this issue Sep 28, 2023 · 2 comments · Fixed by #4752
Labels
bug Something isn't working question Further information is requested

Comments

@rodrigogiraoserrao
Copy link
Contributor

I created this issue to track the issue found and explained in #3415 (comment) in its generality.

As it stands, we treat markup and TCSS in inconsistent ways, as we can see below.
The label widget and the label of the checkbox have the same markup and the same TCSS and yet they look different:

Screenshot 2023-09-28 at 13 44 27

It's also arguable whether any of the two options are the correct one.

Code for the app above
from textual.app import App
from textual.widgets import Checkbox, Label


class CheckboxApp(App):
    CSS = """
    Checkbox > .toggle--label, Label {
        color: white;
        text-opacity: 50%;
    }
    """

    def compose(self):
        yield Checkbox("[red bold]This is just[/] some text.")
        yield Label("[red bold]This is just[/] some text.")


if __name__ == "__main__":
    CheckboxApp().run()
@rodrigogiraoserrao rodrigogiraoserrao added bug Something isn't working question Further information is requested labels Sep 28, 2023
@willmcgugan
Copy link
Collaborator

The toggle widget gives the tcss priority. Alas when you get to that level, you need to take care to apply styles in the correct order.

Going to attempt a fix for the toggle button, but there may be similar issues in other widgets.

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
bug Something isn't working question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants