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

width: 100% mixed with width: auto amongst children has changed recently #4360

Closed
davep opened this issue Mar 29, 2024 · 2 comments · Fixed by #4369
Closed

width: 100% mixed with width: auto amongst children has changed recently #4360

davep opened this issue Mar 29, 2024 · 2 comments · Fixed by #4369
Labels
bug Something isn't working

Comments

@davep
Copy link
Contributor

davep commented Mar 29, 2024

This has been mentioned and reported in a couple of places, and @willmcgugan is aware and considering the issue, but I thought it a good idea to have a central issue recorded for it (if only so there's somewhere to point anyone seeing the same problem with their apps at).

Given this code:

from textual.app import App, ComposeResult
from textual.containers import Vertical
from textual.widgets import Label

class Width100PCentApp(App[None]):

    CSS = """
    Vertical {
        border: solid red;
        width: auto;

        Label {
            border: solid green;
        }

        #first {
            width: 100%;
        }

        #second {
            width: auto;
        }
    }
    """

    def compose(self) -> ComposeResult:
        with Vertical():
            yield Label("I want to be 100% of my parent", id="first")
            yield Label("I want my parent to be wide enough to wrap me and no more", id="second")

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

until very recently this would result in the container being wide enough to contain the widest child, and the more-narrow child growing to fit the width of the container. Visually something like this:

Screenshot 2024-03-29 at 08 43 26

As of (I think) 0.54, this has changed, and now the width: 100% within a width: auto container is causing the container to grow too wide:

Screenshot 2024-03-29 at 08 43 49

This has been the cause of Textualize/trogon#77 and Textualize/frogmouth#98 as well as #4354. I've not checked yet but I strongly suspect this will also have broken ModalScreen dialogs on a couple of my main applications too, if used with 0.54.

@TomJGooding
Copy link
Contributor

Looks like f094588 is the bad commit.

davep added a commit to Textualize/frogmouth that referenced this issue Mar 29, 2024
See #98 and Textualize/textual#4360 for more
context. For the moment this commit will undo the change made in respect to
the request made in #94, but we'll have to remember to unpin again as soon
as the Textual issue is resolved.
@willmcgugan willmcgugan mentioned this issue Mar 31, 2024
Copy link

github-actions bot commented Apr 1, 2024

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

Successfully merging a pull request may close this issue.

2 participants