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

Touch scrolling in menus broken in 11.0.5+ #15288

Closed
stogle opened this issue Apr 9, 2024 · 5 comments · Fixed by #15524
Closed

Touch scrolling in menus broken in 11.0.5+ #15288

stogle opened this issue Apr 9, 2024 · 5 comments · Fixed by #15524
Labels

Comments

@stogle
Copy link
Contributor

stogle commented Apr 9, 2024

Describe the bug

In Avalonia 11.0.4 and earlier, using the Fluent theme, if you had a menu with enough items to require scrolling, you could scroll the menu with touch by swiping up and down. This is no longer the case in 11.0.5 and later (and was never the case with Simple theme). Furthermore, interaction with the scroll bar via touch seems to be broken, so no way to scroll at all on a tablet.

To Reproduce

Create a new Avalonia .NET app with:

MainWindow.xaml

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="MenuScrollBug.MainWindow"
        Title="MenuScrollBug">
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="File">
                <MenuItem Header="MenuItem 01" /><MenuItem Header="MenuItem 02" />
                <MenuItem Header="MenuItem 03" /><MenuItem Header="MenuItem 04" />
                <MenuItem Header="MenuItem 05" /><MenuItem Header="MenuItem 06" />
                <MenuItem Header="MenuItem 07" /><MenuItem Header="MenuItem 08" />
                <MenuItem Header="MenuItem 09" /><MenuItem Header="MenuItem 10" />
                <MenuItem Header="MenuItem 11" /><MenuItem Header="MenuItem 12" />
                <MenuItem Header="MenuItem 13" /><MenuItem Header="MenuItem 14" />
                <MenuItem Header="MenuItem 15" /><MenuItem Header="MenuItem 16" />
                <MenuItem Header="MenuItem 17" /><MenuItem Header="MenuItem 18" />
                <MenuItem Header="MenuItem 19" /><MenuItem Header="MenuItem 20" />
                <MenuItem Header="MenuItem 21" /><MenuItem Header="MenuItem 22" />
                <MenuItem Header="MenuItem 23" /><MenuItem Header="MenuItem 24" />
                <MenuItem Header="MenuItem 25" /><MenuItem Header="MenuItem 26" />
                <MenuItem Header="MenuItem 27" /><MenuItem Header="MenuItem 28" />
                <MenuItem Header="MenuItem 29" /><MenuItem Header="MenuItem 30" />
                <MenuItem Header="MenuItem 31" /><MenuItem Header="MenuItem 32" />
                <MenuItem Header="MenuItem 33" /><MenuItem Header="MenuItem 34" />
                <MenuItem Header="MenuItem 35" /><MenuItem Header="MenuItem 36" />
                <MenuItem Header="MenuItem 37" /><MenuItem Header="MenuItem 38" />
                <MenuItem Header="MenuItem 39" /><MenuItem Header="MenuItem 40" />
            </MenuItem>
        </Menu>
        <TextBlock />
    </DockPanel>
</Window>
  1. Click on the File menu and attempt to scroll the menu with touch (doesn't work)
  2. Change the Avalonia version to 11.0.4 and try again (works)
  3. Change to Simple theme (doesn't work)

Expected behavior

It should be possible to scroll menus using touch, in both the Fluent and Simple themes, without requiring a mouse or keyboard. Ideally this should be possible by swiping up and down. It should also be possible by dragging the scroll bar (if shown) or tapping the scroll buttons.

  1. Restore support for swiping up and down in Fluent theme from 11.0.4
  2. Add the same capability in Simple theme
  3. If possible, fix touch interaction with scroll bars in menus for both themes

Avalonia version

11.0.10

OS

Windows

Additional context

I looked at changes between 11.0.4 and 11.0.5 but wasn't able to identify what caused this.

@stogle stogle added the bug label Apr 9, 2024
@timunie
Copy link
Contributor

timunie commented Apr 9, 2024

I suggest to test also 11.1 beta.

@stogle
Copy link
Contributor Author

stogle commented Apr 9, 2024

@timunie

I suggest to test also 11.1 beta.

Still broken in 11.1.0-beta1 unfortunately.

@stogle
Copy link
Contributor Author

stogle commented Apr 11, 2024

@timunie I did a binary search on merges between 11.0.4 and 11.0.5 and this issue appeared right after #12666 "Call CaptureLost on gestures when pointer loses capture" was merged. So perhaps @emmauss has an idea?

@stogle
Copy link
Contributor Author

stogle commented Apr 11, 2024

From what I can gather, the issue is that DefaultMenuInteractionHandler captures the pointer in its PointerMoved handler and with the changes in #12666, this causes the ScrollGestureRecognizer to lose its capture.

@stogle
Copy link
Contributor Author

stogle commented Apr 30, 2024

I can confirm that with build 11.2.999-cibuild0047859-alpha it is once again possible to scroll menus by swiping up and down in Fluent theme. 🎉

It's still not possible to do this in Simple theme, nor is it possible to interact with the menu's scrollbar via touch, but I don't think these are regressions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants