Skip to content

[WASM] Programmatic focus scrolls the ScrollViewer when accessibility is enabled #24604

Closed

Description

@MartinZikmund

Current behavior 🐛

On WebAssembly (Skia) with accessibility enabled, programmatically focusing an element that is outside a ScrollViewer's viewport scrolls the ScrollViewer. In WinUI, programmatic focus never scrolls.

Accessibility.focusSemanticElement mirrors XAML focus to the semantic DOM with element.focus(), without { preventScroll: true }. The browser then scrolls the ScrollContentPresenter's semantic <div overflow:scroll> to reveal the node, and the scroll listener forwards that DOM offset to WebAssemblyAccessibility.OnScroll → ScrollContentPresenter.Set. The XAML ScrollViewer scrolls, animated.

This is the cause of the WASM flake Given_TextBox.When_GotFocus_BringIntoView (5 of the last 30 master builds; Expected:<0>. Actual:<N> with varying N, since the scroll is caught mid-animation). It only shows up in shards where earlier Given_Accessible* tests have left accessibility on.

Expected behavior 🎯

Mirroring focus to the semantic DOM does not scroll anything. Scrolling stays owned by XAML, like the text-input extension, which already passes preventScroll: true.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Enable accessibility on Skia WebAssembly.
  2. Put a focusable control below the viewport of a ScrollViewer.
  3. Call control.Focus(FocusState.Programmatic).
  4. The ScrollViewer's VerticalOffset animates away from 0.

Workaround 🛠️

None when accessibility is enabled.

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

WebAssembly

Uno.Sdk version (and other relevant versions) 📦

master (7.0)

IDE version 🧑‍💻

No response

Anything else we need to know? 💬

Related to #24596 (semantic scroll echoes fed back to the ScrollViewer). Keyboard navigation inside the semantic DOM (SemanticElements.ts, FocusTrap.ts) also calls plain .focus(). That was found by code review only and is not covered here.

Activity

  1. added
    kind/bug
    platform/wasm 🌐
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugplatform/wasm 🌐

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions