Skip to content

100% height nodes overflow below certain window height #8017

Closed
DioxusLabs/taffy
#388

Description

@doup

Bevy version

What you did

  • A root wrapper with:
flex-direction: column;
size: 100% 100%;
padding: 8px
gap: 8px;
background-color: black;
  • Inside, two rows with:
size: 100% 50%;
gap: 8px;
  • Inside these rows, two columns, each with:
size: 100% 100%;
background-color: gray;

What went wrong

WIDTH works correctly. But HEIGHT overflows.

When window height is big enough, everything is OK:

image

When window height is below certain value (not sure which one, maybe window.height + 2 * gap?) it start to overflow:

image

Additional information

Related issues??

Working HTML example
<!DOCTYPE html>
<html>
  <head>
    <title>Bevy Percent Height</title>
    <style>
      /* Reset */
      * {
        box-sizing: border-box;
      }

      html,
      body {
        padding: 0;
        margin: 0;
      }

      .root {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100vw;
        height: 100vh;
        padding: 8px;
        background-color: black;
      }

      .row {
        display: flex;
        gap: 8px;
        width: 100%;
        height: 50%;
      }

      .col {
        width: 100%;
        height: 100%;
        background-color: grey;
      }
    </style>
  </head>
  <body>
    <div class="root">
      <div class="row">
        <div class="col"></div>
        <div class="col"></div>
      </div>
      <div class="row">
        <div class="col"></div>
        <div class="col"></div>
      </div>
    </div>
  </body>
</html>

image

Activity

  1. added
    C-BugAn unexpected or incorrect behavior
    S-Needs-TriageThis issue needs to be labelled
    on Mar 10, 2023
  2. added
    A-UIGraphical user interfaces, styles, layouts, and widgets
    and removed
    S-Needs-TriageThis issue needs to be labelled
    on Mar 10, 2023
  3. nicoburns commented on Mar 10, 2023

    @nicoburns
    Contributor

    @doup I'll look into this later, but consider using Stretch alignment rather than 100% width/height where possible. This example works fine if you remove the height: 100% from the inner nodes. Although, having said that, this is really useful for generating test cases for Taffy. So perhaps it is good to continue as you are.

  4. nicoburns commented on Mar 10, 2023

    @nicoburns
    Contributor

    This is fixed in Taffy v0.3.7 please cargo update to get the fix.

  5. doup commented on Mar 13, 2023

    @doup
    ContributorAuthor

    Shouldn't this be kept open until Taffy is upgraded?

  6. nicoburns commented on Mar 13, 2023

    @nicoburns
    Contributor

    @doup It doesn’t really need to be because the fix is in a semver-compatible patch release. So users can get the fix by running cargo update, and any newly created projects will get it automatically. It’s still a good idea to bump the version req in bevy, but it’s effectively fixed even without that.

  7. doup commented on Mar 13, 2023

    @doup
    ContributorAuthor

    Ah, I though that X.Y.Z pinned to patch. I see it's actually a range: >=0.3.5, <0.4.0 👍

  8. added a commit that references this issue on Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UIGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions