Slider with tooltip not releasing mouse capture
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
- Open the Control Gallery, and go to the Slider page
- Start dragging the third slider (
SliderWithTooltip) - Move the mouse outside the window
- Release the mouse button
- 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
I think the same problem is with GridSplitter, so probably Thumb is the reason.
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
}
This issue is probably the same as the one reported in #10904