Avalonia icon indicating copy to clipboard operation
Avalonia copied to clipboard

Slider with tooltip not releasing mouse capture

Open TomEdwardsEnscape opened this issue 2 years ago • 2 comments

Describe the bug Something about having a tooltip is preventing Slider from releasing mouse capture, when the mouse button is released while outside the Avalonia window.

To Reproduce

  1. Open the Control Gallery, and go to the Slider page
  2. Start dragging the third slider (SliderWithTooltip)
  3. Move the mouse outside the window
  4. Release the mouse button
  5. Move back into the window without pressing any buttons

The slider's thumb is still responding to the mouse. This does not happen with any other sliders on the page.

Expected behavior The slider should not respond to the mouse after the mouse button has been released.

Desktop (please complete the following information):

  • OS: Windows
  • Version Git master

TomEdwardsEnscape avatar May 09 '23 14:05 TomEdwardsEnscape

I think the same problem is with GridSplitter, so probably Thumb is the reason.

maxkatz6 avatar May 09 '23 19:05 maxkatz6

I found 10.18 does not have this bug. So by comparing the stacktrace between 11.0 and 10.18, I found the problem may lays in PointerOverPreProcessor.ClearPointerOver. Then I add a simple check, seems solving the bug. I'm not sure if its correct.

        private void ClearPointerOver(IPointer pointer, IInputRoot root,
            ulong timestamp, Point? position, PointerPointProperties properties, KeyModifiers inputModifiers)
        {
            var element = root.PointerOverElement;
            if (element is null)
            {
                return;
            }

            // If the element has been captured, it should keep pointer over state.
            if(element == pointer.Captured)
            {
                return;
            }

            // other codes
        }

yll690 avatar Jun 30 '23 09:06 yll690

This issue is probably the same as the one reported in #10904

mgnslndh avatar Oct 18 '23 15:10 mgnslndh