Skip to content

Textboxes Receive Focus During Scroll on Touch Devices in ScrollViewer #16991

Open
@JanSkvaril

Description

@JanSkvaril

Describe the bug

While working on an Android app, we discovered an issue with the ScrollViewer and input controls (e.g., textboxes). The input controls are being focused when dragging the screen to scroll. In larger forms, this is especially unpleasant, as users often accidentally press other textboxes/inputs while scrolling.

To Reproduce

A simple way to reproduce this issue is to add a large number of textboxes to the ScrollViewer:

<ScrollViewer>
      <StackPanel Name="TextboxContainer">
          <!--  Textboxes  -->
      </StackPanel>
 </ScrollViewer>
public MainView()
{
    InitializeComponent();

    for (int i = 0; i < 100; i++)
    {
        TextboxContainer.Children.Add(new TextBox() { Text="Textbox" + i});
    }
}

I am also attaching a minimal reproduction project and a video demonstrating the issue. In this project, it is impossible to scroll down without activating the textbox.
AvaloniaScrollInputs.zip

screen-20240911-180424.mp4

Expected behavior

The textboxes should not be focused while scrolling on a touch device.

Avalonia version

11.1.3

OS

Android

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions