Skip to content

Keyboard focus navigation in list of items embedded in ScrollViewer causes pointer events to stop working #10474

@rozele

Description

@rozele

Describe the bug

When keyboard navigating (tabbing) between tab-stop ContentControl items in a list rendered in a ScrollViewer, pointer events stop flowing to the app. It seems that the app stops responding to any mouse events.

Steps to reproduce the bug

The following source code reproduces the issue:

  winrt::Microsoft::UI::Xaml::Window window;

  winrt::Microsoft::UI::Xaml::Controls::ScrollViewer rootView;
  winrt::Microsoft::UI::Xaml::Controls::StackPanel content;
  rootView.Content(content);
  
  for (auto i = 0; i < 100; ++i) {
    winrt::Microsoft::UI::Xaml::Controls::TextBlock item;
    item.Text(winrt::hstring{L"Item "} + winrt::to_hstring(i));
    winrt::Microsoft::UI::Xaml::Controls::Grid grid;
    grid.Padding(winrt::Microsoft::UI::Xaml::Thickness{5, 5, 5, 5});
    grid.Children().Append(item);
    grid.PointerEntered([item](auto&&...) {

      item.FontWeight(winrt::Windows::UI::Text::FontWeight{winrt::Windows::UI::Text::FontWeights::Bold()});
    });
    grid.PointerExited([item](auto&&...) {
      item.FontWeight(winrt::Windows::UI::Text::FontWeight{winrt::Windows::UI::Text::FontWeights::Normal()});
    });
    winrt::Microsoft::UI::Xaml::Controls::ContentControl control;
    control.Content(grid);
    control.IsTabStop(true);
    control.UseSystemFocusVisuals(true);
    content.Children().Append(control);
  }

  window.Content(rootView);
  window.Activate();

After launching the app, if I rapidly press the Tab key (or hold the Tab key), while moving the mouse over the items in the list, it eventually gets into a state where the pointer events stop firing on the items.

The app starts responding to pointer events again after pressing any key (other than Tab).

Expected behavior

The app should continue to respond to mouse events after tab navigation stops.

Screenshots

WinUI.Desktop.2025-03-25.15-17-48.mp4

NuGet package version

Windows App SDK 1.7.0: 1.7.250310001

Packaging type

Unpackaged

Windows version

Windows 10 version 22H2 (19045)

IDE

Other

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Pointerfix-releasedThe fix has been in a release (experimental, preview, stable, or servicing).team-CompInputIssue for IXP (Composition, Input) team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions