bevyengine / bevyengine/bevy

`Display::None` propagation bug

Open
#16,904 0 comments 0 reactions 0 assignees View on GitHub
A-UI C-Bug S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

Main

## What you did

Added red outlines to the innermost node of Bevy's `display_and_visibility` example.

```cargo run --example display_and_visibility```

1. Without `Display::None` set:
Image

2. With `Display::None` set on the innermost node:
Image

3. With `Display::None` set on the outermost node:
Image

## What went wrong

During layout recomputation if a node is found with `Display::None` set, that node and all its descendants are given a zero size.
This means most systems ignore those nodes since you can't mouse-over or draw inside a zero-sized element.

However zero-sized nodes can have outlines and outlines extraction only checks the local `Display::None` value for the outlined node and not the `Display` value of its ancestors. Which is why in `3` there is a visible outline around a UI node that should be removed from the layout and shouldn't even have a position to draw an outline around.

Contributor guide

Open the contributing guide

Research direction

Run the display_and_visibility example and compare the three cases described in the issue. Trace outline extraction for the innermost node, checking how an ancestor's Display::None affects descendants; done means descendants of a hidden ancestor produce no visible outline.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.