diff --git a/Cargo.toml b/Cargo.toml index 28fb16ffcc7f2..1775b2dd7b7d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2972,6 +2972,17 @@ description = "Demonstrates text wrapping" category = "UI (User Interface)" wasm = true +[[example]] +name = "ghost_nodes" +path = "examples/ui/ghost_nodes.rs" +doc-scrape-examples = true + +[package.metadata.example.ghost_nodes] +name = "Ghost Nodes" +description = "Demonstrates the use of Ghost Nodes to skip entities in the UI layout hierarchy" +category = "UI (User Interface)" +wasm = true + [[example]] name = "grid" path = "examples/ui/grid.rs" diff --git a/crates/bevy_ui/src/accessibility.rs b/crates/bevy_ui/src/accessibility.rs index 53cfb272b2219..fb17415fe2eb4 100644 --- a/crates/bevy_ui/src/accessibility.rs +++ b/crates/bevy_ui/src/accessibility.rs @@ -1,6 +1,6 @@ use crate::{ prelude::{Button, Label}, - Node, UiImage, + Node, UiChildren, UiImage, }; use bevy_a11y::{ accesskit::{NodeBuilder, Rect, Role}, @@ -14,15 +14,14 @@ use bevy_ecs::{ system::{Commands, Query}, world::Ref, }; -use bevy_hierarchy::Children; use bevy_render::{camera::CameraUpdateSystem, prelude::Camera}; use bevy_text::Text; use bevy_transform::prelude::GlobalTransform; -fn calc_name(texts: &Query<&Text>, children: &Children) -> Option> { +fn calc_name(texts: &Query<&Text>, children: impl Iterator) -> Option> { let mut name = None; for child in children { - if let Ok(text) = texts.get(*child) { + if let Ok(text) = texts.get(child) { let values = text .sections .iter() @@ -59,11 +58,12 @@ fn calc_bounds( fn button_changed( mut commands: Commands, - mut query: Query<(Entity, &Children, Option<&mut AccessibilityNode>), Changed