Skip to content

FixedNode#24323

Open
ickshonpe wants to merge 7 commits into
bevyengine:mainfrom
ickshonpe:FixedNode
Open

FixedNode#24323
ickshonpe wants to merge 7 commits into
bevyengine:mainfrom
ickshonpe:FixedNode

Conversation

@ickshonpe
Copy link
Copy Markdown
Contributor

@ickshonpe ickshonpe commented May 16, 2026

Objective

Allow UI elements to be positioned relative to the window rather than its parent element.

Fixes #9564

Solution

New UI marker component FixedNode.
FixedNode entities are treated as UI roots in layout, even if they have a parent.
During the taffy layout updates children with FixedNode are skipped.

--

The original suggestion was to implement it as a PositionType::Fixed variant that could used with Node, but I think that would be much more complicated without support from Taffy. Being able to just directly query for and filter out FixedNode entities directly makes everything much simpler.

Testing

Basic example which shows events bubbling up to the parent from the fixed node:

cargo run --example fixed_node

I need to write some tests to make sure the layout isn't broken when FixedNodes are removed or reparented etc, but otherwise it seems like a reasonable approach.

@ickshonpe ickshonpe added A-UI Graphical user interfaces, styles, layouts, and widgets D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels May 16, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI May 16, 2026
@ickshonpe ickshonpe requested a review from viridia May 16, 2026 21:41
Copy link
Copy Markdown
Contributor

@viridia viridia left a comment

Choose a reason for hiding this comment

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

Release note please :)

@amtep
Copy link
Copy Markdown
Contributor

amtep commented May 16, 2026

What should happen if a root node has FixedNode? I think right now the code makes the assumption that the sets are disjoint.

@ickshonpe ickshonpe added the M-Release-Note Work that should be called out in the blog due to impact label May 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note.

Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes.

@ickshonpe
Copy link
Copy Markdown
Contributor Author

What should happen if a root node has FixedNode? I think right now the code makes the assumption that the sets are disjoint.

Hopefully just adding a Without<Children> filter to the FixedNode queries will be sufficient. GhostNodes might cause some problems though. I'll add some comprehensive tests tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-UI Graphical user interfaces, styles, layouts, and widgets D-Straightforward Simple bug fixes and API improvements, docs, test and examples M-Release-Note Work that should be called out in the blog due to impact

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

Add PositionType::Fixed

3 participants