Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled Controls Inside ScrollViewer Consume Scroll Input Preventing Scrolling #17880

Open
AVVI94 opened this issue Jan 3, 2025 · 0 comments
Labels

Comments

@AVVI94
Copy link

AVVI94 commented Jan 3, 2025

Describe the bug

Issue Overview

When a disabled control (IsEnabled="False") is placed inside a ScrollViewer, it incorrectly intercepts and consumes mouse scroll input events, preventing the ScrollViewer from handling them as intended. This behavior occurs even if the disabled controls, such as a TextBlock or a TextBox, are not focusable and are not actively interacting with the user. The problem is evident when the mouse is positioned over these controls, and the user attempts to scroll the ScrollViewer.

Observed Behavior

  • Scroll input is intercepted by the disabled controls, preventing the ScrollViewer from scrolling.
  • The issue is observed with both focusable controls (e.g., TextBox) and non-focusable controls (e.g., TextBlock), indicating that the disabled state alone is causing the problem.
  • The controls effectively "block" the scroll event, creating a poor user experience, as users cannot scroll when the cursor is positioned over disabled elements.

Problem occured after upgrading from Avalonia 11.0.10 to >= 11.1.0.

To Reproduce

  1. Create a ScrollViewer with content that exceeds the viewport, allowing scrolling.
  2. Inside the ScrollViewer, place a container (e.g., DockPanel) with IsEnabled="False".
  3. Populate the disabled container with child elements such as TextBlock and TextBox.
  4. Run the application and hover the mouse cursor over the disabled elements.
  5. Attempt to scroll using the mouse wheel.

Expected behavior

  • Mouse scroll events should propagate to the ScrollViewer, allowing scrolling regardless of whether the child controls are disabled.
  • Disabled controls should not interfere with input event handling when they are visually non-interactive.

Avalonia version

>= 11.1.0

OS

Windows

Additional context

Tested with this XAML code:

<ScrollViewer>
    <DockPanel IsEnabled="False">
        <TextBlock Text="AAAAAAAAAAAAAAAAAAAA" DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 IsEnabled="False"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
        <TextBox Margin="0,10"
                 HorizontalAlignment="Stretch"
                 DockPanel.Dock="Top" />
    </DockPanel>
</ScrollViewer>
@AVVI94 AVVI94 added the bug label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant