Skip to content

100% height nodes overflow below certain window height #8017

@doup

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

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