-
Notifications
You must be signed in to change notification settings - Fork 841
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
fix refresh on remove #2008
fix refresh on remove #2008
Conversation
self.refresh(layout=True) | ||
if parent.styles.auto_dimensions: | ||
parent.refresh(layout=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to refresh the layout of the parent, regardless of whether they have auto dimensions or not?
Imagine the parent has fixed dimensions but the children have relative dimensions (e.g., fr
units).
Don't we need the refresh to make sure the children make use of the space that was just made available?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto dimensions and relative units kind of cancel each other out.
Consider a container with auto height and a single child with height 1fr
. The widget needs to know the height of the container, but the container needs to know the height of the child. So auto height considers all relative dimensions to be zero. It will still respect minimums, so essentially what it calculates is the minimal value which satisfies all constraints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's interesting.
Up until now, I interpreted 1fr
to mean that it would expand as much as possible while also respecting relative ratios to other widgets with fr
dimensions.
Then, if the parent has auto
and the child has 1fr
, the child should look at the grandparent to find the maximum size it can occupy and the parent would expand to that size.
This is the behaviour I find more consistent with the interaction between absolute sizes and 1fr
.
If a parent has a fixed size and the child has 1fr
, the child will expand as much as possible. Hence, I have been taking the "expand as much as possible" as the interpretation of 1fr
, which I don't think should fall apart when the parent is auto
.
Not a blocker to approval, but I wonder if we should have a snapshot test for this? |
Fixes #2007