Fix Button controls remaining in pressed state on Windows touch screens#26
Draft
Fix Button controls remaining in pressed state on Windows touch screens#26
Conversation
This reverts commit 138797f.
Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>
Co-authored-by: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Button and Border Controls Remain in Pressed State on Windows Touch Screens
Fix Button controls remaining in pressed state on Windows touch screens
Aug 1, 2025
546914f to
513755f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where Button and Border controls inside ScrollView remain stuck in "Pressed" visual state when touched and dragged outside their bounds on Windows touch screen devices.
Problem
The issue occurs because
ButtonHandler.Windows.csonly listens toPointerPressedandPointerReleasedevents on the button itself. When a user touches a button and drags their finger outside the button bounds, thePointerReleasedevent is not fired on the button, leaving it permanently in the pressed state.This creates a poor user experience on touch devices where users expect buttons to return to their normal state when they move their finger away from the button area.
Solution
Added two new event handlers to
ButtonHandler.Windows.cs:OnPointerExited- Clears the pressed state when the pointer leaves the button boundsOnPointerCanceled- Clears the pressed state when the pointer interaction is interruptedBoth handlers check the
_isPressedstate before callingVirtualView?.Released()to avoid unnecessary work. The handlers are properly registered inConnectHandlerand cleaned up inDisconnectHandler.Code Changes
Testing
Issue25.xaml) that demonstrates the fix with interactive buttons and real-time status updatesThe fix is minimal, focused, and follows established patterns in the MAUI codebase. It ensures buttons behave consistently with modern touch UI expectations without affecting other platforms or interaction methods.
Fixes #25.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
4vyvsblobprodcus361.vsblob.vsassets.iodotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -c Debug(dns block)4zjvsblobprodcus390.vsblob.vsassets.iodotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -c Debug(dns block)gervsblobprodcus329.vsblob.vsassets.iodotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -c Debug(dns block)jd4vsblobprodcus366.vsblob.vsassets.iodotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -c Debug(dns block)kxqvsblobprodcus376.vsblob.vsassets.iodotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -c Debug(dns block)o3svsblobprodcus318.vsblob.vsassets.iodotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -c Debug(dns block)rcxvsblobprodcus328.vsblob.vsassets.iodotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -c Debug(dns block)tphvsblobprodcus375.vsblob.vsassets.iodotnet build src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj -c Debug(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.