Skip to content

Block stretch sizing fixes #674

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

Merged
merged 2 commits into from
Jul 1, 2024

Conversation

nicoburns
Copy link
Collaborator

Objective

  • Fix block nodes stretch-fitting when they shouldn't.

Context

  • Block nodes were (unconditionally) stretch-fitting themselves. However block nodes only stretch-fit into available space if their parent is also a block node (it is really block containers that cause stretch-fitting, not block children).

Changes made

  • Block nodes no longer stretch-fit into available space
  • The root node (regardless of display mode) now does stretch-fit into available space (if it is definite). I think this is correct, but not 100% sure.

Future work

  • Block nodes still unconditionally stretch-fit their children. This is usually what we want, but there are exceptions in HTML (for example table children of blocks do not stretch-fit) which we will likely want to support in future.

Feedback wanted

Does the root node being forced into taking up all available space (in the horizontal axis) when available space is definite actually make sense?

@nicoburns nicoburns added the bug Something isn't working label Jun 29, 2024
Copy link
Collaborator

@TimJentzsch TimJentzsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you able to define a test case for this which wouldn't pass for the old version and passes now?
I think that would be great to add to prevent regressions.

I'm not sure about the root node behavior... 🤔

@nicoburns nicoburns force-pushed the block-stretch-sizing-fixes branch from 9ea3928 to 458d78b Compare July 1, 2024 22:33
@nicoburns nicoburns force-pushed the block-stretch-sizing-fixes branch from 458d78b to 48f62f9 Compare July 1, 2024 22:51
@nicoburns nicoburns enabled auto-merge (squash) July 1, 2024 22:51
@nicoburns
Copy link
Collaborator Author

I think this is definitely better than what we had before. We can iterate on the root layout as required.

@nicoburns nicoburns merged commit 9651a18 into DioxusLabs:main Jul 1, 2024
19 checks passed
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 this pull request may close these issues.

2 participants