bevyengine / bevyengine/bevy

Reconsider design of `WindowTraversal` to decouple `input_focus`

Open
#19,770 0 comments 0 reactions 0 assignees View on GitHub
A-Input A-UI C-Code-Quality S-Needs-Design X-Contentious
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

Originally posted by @ickshonpe in https://github.com/bevyengine/bevy/pull/19736#discussion_r2160081772:

> I really don't like that part of the design of `WindowTraversal` then, but I can see that it's out of scope to complain about it here. Feels like probably the input focus module shouldn't need to have any knowledge of windows at all.

>> Given that there are several places in Bevy where a UI node wants to know what window it's on, I wonder if it makes sense to propagate the window ref downward in the hierarchy (now that we have propagation).
>
> The UI already does window entity propagation through the `ComputedNodeTarget` component. Maybe the propagation system needs to be replaced using the new features though.

Contributor guide

Open the contributing guide

Research direction

Start by reading the WindowTraversal and input_focus design discussed in PR #19736, then inspect how ComputedNodeTarget propagates a UI node's window entity. Determine whether window knowledge can be removed from input focus and whether existing propagation should be replaced. Done means an agreed, implemented design that decouples these responsibilities without losing window information for UI nodes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.