Skip to main content

apply_a11y_scroll_into_view

Function apply_a11y_scroll_into_view 

Source
pub fn apply_a11y_scroll_into_view(
    requests: ResMut<'_, A11yScrollIntoViewRequests>,
    parents: Query<'_, '_, &ChildOf>,
    transforms: Query<'_, '_, &Transform>,
    scrolls: Query<'_, '_, (&Transform, &mut Scroll, &mut ScrollOffset)>,
)
Expand description

W5.3 consumer for inbound Action::ScrollIntoView AccessKit actions.

  • Drains lumen_core::components::A11yScrollIntoViewRequests each tick. For every requested entity, walks the [ChildOf] chain up to the nearest ancestor that carries Scroll + ScrollOffset and updates the offset so the target’s bounding box sits inside the container’s viewport rect.
  • Vertical-axis containers move the offset along Y, horizontal along X, Both along both axes simultaneously.
  • When the target is already fully visible, the offset is left untouched (idempotent - repeated requests don’t drift).
  • Velocity on the target axis is zeroed so a previously-fired inertial fling does not immediately scroll back away from the focused element.
  • The actual clamp to [0, content - viewport] is left to clamp_scroll_offsets which runs in TickStage::A11ySync after this system.