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

TabbedContent styling affects child widgets #4232

Closed
davep opened this issue Feb 28, 2024 · 1 comment · Fixed by #4283
Closed

TabbedContent styling affects child widgets #4232

davep opened this issue Feb 28, 2024 · 1 comment · Fixed by #4283
Assignees
Labels
bug Something isn't working Task

Comments

@davep
Copy link
Contributor

davep commented Feb 28, 2024

TabbedContent is a little too broad in how it styles some things; this can be shown with the following code:

from textual.app import App, ComposeResult
from textual.containers import Horizontal, Vertical
from textual.widgets import Button, Tabs, TabbedContent, TabPane, Label

class TabsStyleLeakApp(App[None]):

    CSS = """
    Vertical, TabbedContent {
        width: 1fr;
    }
    """

    def stuff(self) -> ComposeResult:
        yield Label("This label is topmost")
        yield Button("This button is second")
        yield Tabs("After", "Button")

    def compose(self) -> ComposeResult:
        with Horizontal():
            with Vertical():
                yield from self.stuff()
            with TabbedContent():
                with TabPane("Test"):
                    yield from self.stuff()

if __name__ == "__main__":
    TabsStyleLeakApp().run()

This results in the following:

Screenshot 2024-02-28 at 10 18 13

Note how the Tabs is composed last but within the TabbedContent it's displaying first due to the use of dock on Tabs within TabbedContent.

@davep davep added bug Something isn't working Task labels Feb 28, 2024
davep added a commit to davep/textual-sandbox that referenced this issue Feb 28, 2024
@davep davep self-assigned this Mar 12, 2024
davep added a commit to davep/textual that referenced this issue Mar 12, 2024
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 Task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant