Fix SfExpander arrow color not restoring after cancelled touch gesture #230
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.
Problem
When a user long-presses on a collapsed SfExpander header and slides their finger off the expander before releasing (which cancels the expansion), the arrow icon remains stuck in the pressed color instead of returning to the configured
HeaderIconColor
.This issue occurs because:
PressedIconColor
Reproduction Steps
HeaderIconColor
to a distinct color (e.g., Blue)PressedIconColor
to a different color (e.g., Red)Solution
Added icon color restoration logic in the
OnTouch
method forPointerActions.Released
andPointerActions.Cancelled
events:For Released events:
HeaderIconColor
HoverIconColor
HeaderIconColor
For Cancelled events:
HeaderIconColor
(mouse hover is reset)The restoration logic follows the same pattern as the existing
OnPropertyChanged
method to ensure consistency with visual state groups and hover behaviors.Testing
Added unit tests to verify:
Code Changes
maui/src/Expander/ExpanderHeader.cs
- Added icon color restoration inOnTouch
methodSfExpanderUnitTests.cs
to verify the fixThis is a minimal, surgical fix that only adds the missing color restoration without affecting any other functionality.
Fixes #216.