bevy/examples/ui
ickshonpe 3edacb5e46
Enable accessibility features for the button example (#18749)
# Objective

Accessibility features don't work with the UI `button` example because
`InputFocus` must be set for the accessibility systems to recognise the
button.

Fixes #18760

## Solution

* Set the button entity as the `InputFocus` when it is hovered or
pressed.
* Call `set_changed` on the `Button` component when the button's state
changes to hovered or pressed (the accessibility system's only update
the button's state when the `Button` component is marked as changed).

## Testing

Install NVDA, it should say "hover" when the button is hovered and
"pressed" when the button is pressed.

The bounds of the accessibility node are reported incorrectly. I thought
we fixed this, I'll take another look at it. It's not a problem with
this PR.
2025-05-26 15:19:55 +00:00
..
borders.rs refactor ui/borders example to use new children! macro (#18962) 2025-05-04 08:35:03 +00:00
box_shadow.rs Rename UiBoxShadowSamples to BoxShadowSamples. (#16505) 2024-12-03 19:43:26 +00:00
button.rs Enable accessibility features for the button example (#18749) 2025-05-26 15:19:55 +00:00
directional_navigation.rs Fix a few subcrate import paths in examples (#19002) 2025-04-30 18:41:17 +00:00
display_and_visibility.rs
flex_layout.rs
font_atlas_debug.rs Upgrade to Rust Edition 2024 (#17967) 2025-02-24 03:54:47 +00:00
ghost_nodes.rs Switch ChildOf back to tuple struct (#18672) 2025-04-02 00:10:10 +00:00
gradients.rs UI Node Gradients (#18139) 2025-05-20 14:45:22 +00:00
grid.rs
overflow_clip_margin.rs
overflow_debug.rs
overflow.rs
radial_gradients.rs UI Node Gradients (#18139) 2025-05-20 14:45:22 +00:00
relative_cursor_position.rs
render_ui_to_texture.rs Rename TargetCamera to UiTargetCamera (#17403) 2025-01-19 19:56:57 +00:00
scroll.rs Unified picking cleanup (#18401) 2025-03-18 20:28:03 +00:00
size_constraints.rs Renamed EventWriter::send methods to write. (#17977) 2025-02-23 21:18:52 +00:00
stacked_gradients.rs UI Node Gradients (#18139) 2025-05-20 14:45:22 +00:00
tab_navigation.rs Unified picking cleanup (#18401) 2025-03-18 20:28:03 +00:00
text_background_colors.rs Text background colors (#18892) 2025-05-04 08:18:46 +00:00
text_debug.rs Fix non-crate typos (#18219) 2025-03-11 06:17:48 +00:00
text_wrap_debug.rs
text.rs
transparency_ui.rs
ui_material.rs ui_material example webgl2 fix (#17852) 2025-02-13 20:52:26 +00:00
ui_scaling.rs
ui_texture_atlas_slice.rs
ui_texture_atlas.rs UiImage -> ImageNode, UiImageSize -> ImageNodeSize (#16271) 2024-11-07 21:52:58 +00:00
ui_texture_slice_flip_and_tile.rs BorderRect maintenance (#16727) 2024-12-12 04:33:44 +00:00
ui_texture_slice.rs
viewport_debug.rs Fix non-crate typos (#18219) 2025-03-11 06:17:48 +00:00
viewport_node.rs Add a viewport UI widget (#17253) 2025-05-05 22:57:37 +00:00
window_fallthrough.rs Fix non-crate typos (#18219) 2025-03-11 06:17:48 +00:00
z_index.rs