FeathersNumberInput text input node can be left with zero width when an unrelated node is hovered

Open
#26,339 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@collapsedonion is already working on this.

Since Oct 28, 2026.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
frontend

Research direction

Start by locating the Bevy Feathers number input implementation and its UI layout tests; the issue does not name specific files. Reproduce the two side-by-side inputs and hover one, then inspect why the other input's text node gets zero width when its container has max_width but no explicit width. Done when the non-hovered input retains a visible text area and a regression test covers the layout.

Written by the indexing model from the issue text.

Description

A-UI C-Bug D-Modest S-Ready-For-Implementation

Bevy version and features

bevy = { version = "0.20.0", features = ["bevy_feathers"] }

What you did

Two FeathersNumberInputs side by side, each in its own Baseline row inside a column inside a shared row, then hover one of them.

use bevy::{
    feathers::{
        FeathersPlugins,
        controls::{
            FeathersNumberInput, FeathersTextInput, HardLimit, NumberInputPrecision,
            NumberInputStep, NumberInputValue, SoftLimit,
        },
        dark_theme::create_dark_theme,
        theme::{ThemeBackgroundColor, UiTheme},
        tokens,
    },
    prelude::*,
    ui::ComputedNode,
};

#[derive(Component, Clone, Copy, Default)]
struct Left;
#[derive(Component, Clone, Copy, Default)]
struct Right;

#[derive(SceneComponent, Clone, Default)]
struct ReproNumberInput;

impl ReproNumberInput {
    fn scene() -> impl Scene {
        bsn! {
            @FeathersNumberInput
            Node {
                // width: px(100), // This fixes the issue
                max_width: px(100),
            }
            NumberInputValue::F32(1.0)
            NumberInputPrecision(1)
            NumberInputStep(0.1)
            SoftLimit::f32(0.1..=3.0)
            HardLimit::f32(0.1..=3.0)
        }
    }
}

fn main() {
    App::new()
        .add_plugins((
            DefaultPlugins.set(WindowPlugin {
                primary_window: Some(Window {
                    resolution: (400, 200).into(),
                    ..default()
                }),
                ..default()
            }),
            FeathersPlugins,
        ))
        .insert_resource(UiTheme(create_dark_theme()))
        .add_systems(Startup, setup)
        .add_systems(Update, drive)
        .run();
}

fn setup(mut commands: Commands) {
    commands.spawn_scene_list(bsn_list! {
        Camera2d
        IsDefaultUiCamera
        --
        Node {
            width: percent(100),
            height: percent(100),
            align_items: AlignItems::Center,
            justify_content: JustifyContent::Center,
        }
        ThemeBackgroundColor(tokens::WINDOW_BG)
        Children [
            Node {
                flex_direction: FlexDirection::Column,
                justify_content: JustifyContent::FlexStart,
                flex_grow: 1.0,
                height: percent(100),
            }
            Children [
                Node {
                    flex_direction: FlexDirection::Row,
                    justify_content: JustifyContent::FlexStart,
                    align_items: AlignItems::Baseline,
                }
                Children [
                    Node {
                        width: px(18),
                        min_width: px(18),
                        height: px(18),
                    }
                    --
                    @ReproNumberInput
                    Left
                ]
            ]
            --
            Node {
                flex_direction: FlexDirection::Column,
                justify_content: JustifyContent::FlexStart,
                flex_grow: 1.0,
                height: percent(100),
            }
            Children [
                Node {
                    flex_direction: FlexDirection::Row,
                    justify_content: JustifyContent::FlexStart,
                    align_items: AlignItems::Baseline,
                }
                Children [
                    Node {
                        width: px(18),
                        min_width: px(18),
                        height: px(18),
                    }
                    --
                    @ReproNumberInput
                    Right
                ]
            ]
        ]
    });
}

fn text_node_of(
    root: Entity,
    children: &Query<&Children>,
    is_text_input: &Query<(), With<FeathersTextInput>>,
) -> Option<Entity> {
    children
        .iter_descendants(root)
        .find(|e| is_text_input.contains(*e))
}

fn text_width(
    root: Entity,
    children: &Query<&Children>,
    is_text_input: &Query<(), With<FeathersTextInput>>,
    nodes: &Query<&ComputedNode>,
) -> Option<f32> {
    let text = text_node_of(root, children, is_text_input)?;
    nodes.get(text).ok().map(|n| n.size().x)
}

fn drive(
    mut verdict: Local<bool>,
    q_left: Query<Entity, With<Left>>,
    q_right: Query<Entity, With<Right>>,
    q_children: Query<&Children>,
    q_is_text_input: Query<(), With<FeathersTextInput>>,
    q_nodes: Query<&ComputedNode>,
) {
    let Ok(left) = q_left.single() else { return };
    let Ok(right) = q_right.single() else { return };
    let left_width = text_width(left, &q_children, &q_is_text_input, &q_nodes);
    let right_width = text_width(right, &q_children, &q_is_text_input, &q_nodes);

    if right_width == Some(0.0) && left_width == Some(0.0) {
        return;
    }
    if !*verdict && (right_width == Some(0.0) || left_width == Some(0.0)) {
        info!("left text width = {left_width:?}, right text width = {right_width:?}");
        *verdict = true;
    }
}

What went wrong

The other (non-hovered) FeathersNumberInput renders as a blank grey rectangle. Its text node's ComputedNode::size().x becomes 0 while its height stays non-zero, so only the containers background shows through.

Output from the above repro when hovering over the left input:
left text width = Some(200.0), right text width = Some(0.0)

Additional information

AI was used to help reduce the reproduction to its minimal form.

Initial screenshot:

Image

Screenshot after hovering over leftmost FeathersNumberInput:

Image

Adding an explicit width: px(100) to the FeathersNumberInput Node fixes the issue.

Dominant language
Rust
Stars
49.8k
Forks
5.1k
Avg merge
3d 4h
Merged PRs (30d)
136

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bevyengine/bevy

All issues in bevyengine/bevy

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.