Shell Flyout appears in Release builds even when FlyoutBehavior="Disabled" - fix#32648
Shell Flyout appears in Release builds even when FlyoutBehavior="Disabled" - fix#32648kubaflo wants to merge 2 commits intodotnet:mainfrom
Conversation
Added logic to disable the pan gesture recognizer when FlyoutBehavior is set to Disabled. This prevents unintended gesture interactions when the flyout is not available.
Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com>
Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com>
) * [iOS 26] Fix null reference and cast safety in ShellSectionRenderer navigation (#7) * Initial plan * Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. * Fix inconsistent cast in ElementForViewController method * Complete PR dotnet#32456 review with detailed analysis Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> * Initial plan * Applied PR dotnet#32648 changes for review Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Add UI test case for issue dotnet#32616 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Final review summary for PR dotnet#32648 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
* [iOS 26] Fix null reference and cast safety in ShellSectionRenderer navigation (#7) * Initial plan * Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. * Fix inconsistent cast in ElementForViewController method * Complete PR dotnet#32456 review with detailed analysis Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> * Initial plan * Applied PR dotnet#32648 changes for review Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Add UI test case for issue dotnet#32616 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Final review summary for PR dotnet#32648 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com> Co-Authored-By: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
PR #32648 Review SummaryOverviewPR Title: Disable pan gesture when flyout is disabled Problem StatementOn MacCatalyst (and iOS), setting Solution AnalysisChanges MadeThe PR modifies
Technical Correctness✅ Correct Approach
✅ Defense in Depth
✅ Proper Lifecycle Management
✅ Minimal Changes
Code QualityPositive Aspects:
Minor Observations:
Platform ComparisonAndroid (for reference)Android already handles this correctly in case FlyoutBehavior.Disabled:
_currentLockMode = LockModeLockedClosed;
SetDrawerLockMode(_currentLockMode);The iOS fix follows the same pattern - disabling the gesture mechanism when behavior is TestingExisting TestsNo automated UI test existed for this specific regression scenario. Added Test CoverageCreated comprehensive UI test case:
Test Scenario:
This test will prevent future regressions of this issue. Build Verification✅ Code builds successfully with .NET 10.0.100 Review RecommendationsFor PR Author
For Reviewers
Risk AssessmentRisk Level: Low Reasoning:
ConclusionRecommendation: APPROVE ✅ This PR correctly fixes the reported regression with a minimal, well-structured change that follows MAUI platform patterns. The solution is sound, builds successfully, and includes appropriate test coverage to prevent future regressions. Summary
The PR is ready to merge. |
* [iOS 26] Fix null reference and cast safety in ShellSectionRenderer navigation (#7) * Initial plan * Add null checks in ShellSectionRenderer Added additional null checks for page and renderer references in ShellSectionRenderer to prevent potential null reference exceptions during navigation and view controller handling. * Fix inconsistent cast in ElementForViewController method * Complete PR dotnet#32456 review with detailed analysis Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com> * Initial plan * Applied PR dotnet#32648 changes for review Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Add UI test case for issue dotnet#32616 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> * Final review summary for PR dotnet#32648 Co-authored-by: kubaflo <42434498+kubaflo@users.noreply.github.com> --------- Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com> Co-Authored-By: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where the Shell flyout could still be opened via pan gesture on iOS/MacCatalyst even when FlyoutBehavior is set to Disabled. The fix disables the pan gesture recognizer when the flyout behavior is disabled.
Key Changes:
- Added
UpdatePanGestureEnabled()method to explicitly disable/enable the pan gesture recognizer based on flyout behavior - Added guard check in
ShouldReceiveTouchcallback to prevent gesture handling when disabled - Created comprehensive UI tests to verify flyout icon visibility and behavior across different flyout states
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellFlyoutRenderer.cs | Implements pan gesture disabling logic by adding UpdatePanGestureEnabled() method and early return check in ShouldReceiveTouch callback |
| src/Controls/tests/TestCases.HostApp/Issues/Issue32616.cs | Creates test page with UI for toggling flyout behavior between Enabled and Disabled states |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32616.cs | Implements automated UI test that verifies flyout icon appears/disappears correctly when flyout is enabled/disabled |
| if (_flyoutBehavior == FlyoutBehavior.Disabled) | ||
| return false; | ||
|
|
There was a problem hiding this comment.
The ShouldReceiveTouch callback now has redundant logic. Lines 77-78 check if _flyoutBehavior == FlyoutBehavior.Disabled and return false, but lines 80-81 also check if _flyoutBehavior != FlyoutBehavior.Flyout and return false. This means the check on line 77 is redundant since Disabled is already covered by the != FlyoutBehavior.Flyout condition on line 80.
Consider removing lines 77-78 since the UpdatePanGestureEnabled() method now disables the gesture recognizer entirely when FlyoutBehavior.Disabled, making this additional check in ShouldReceiveTouch unnecessary. The gesture recognizer won't even receive touch events when disabled.
| if (_flyoutBehavior == FlyoutBehavior.Disabled) | |
| return false; | |
| @@ -0,0 +1,76 @@ | |||
| namespace Maui.Controls.Sample.Issues; | |||
|
|
|||
| [Issue(IssueTracker.Github, 32616, "Shell Flyout appears in Release builds even when FlyoutBehavior=\"Disabled\" (MacCatalyst)", PlatformAffected.macOS)] | |||
There was a problem hiding this comment.
The Issue attribute specifies PlatformAffected.macOS, but according to the UI testing guidelines, tests should run on all applicable platforms by default unless there's a specific technical limitation. The title mentions "(MacCatalyst)" but the fix is applied to iOS code (ShellFlyoutRenderer.cs in the iOS folder), which means this issue likely affects both iOS and MacCatalyst.
Consider using PlatformAffected.iOS | PlatformAffected.macOS to accurately reflect the platforms affected by this issue, or verify if this is truly MacCatalyst-only. If it affects both platforms, the platform specification should reflect that.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
Added logic to disable the pan gesture recognizer when FlyoutBehavior is set to Disabled. This prevents unintended gesture interactions when the flyout is not available.
Issues Fixed
Fixes #32616