[iOS 26 & Catalyst 26] [Follow-up PR] Fixed IsEnabled behavior on Tabs#33337
[iOS 26 & Catalyst 26] [Follow-up PR] Fixed IsEnabled behavior on Tabs#33337rmarinho merged 3 commits intodotnet:mainfrom
Conversation
|
Hey there @@SubhikshaSf4851! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Pull request overview
This PR fixes the IsEnabled property for Shell tabs on iOS and Mac Catalyst. Previously, disabled tabs could still be selected through drag gestures or direct selection. The fix implements initial IsEnabled state application at tab creation and prevents selection of disabled tabs in the ShouldSelectViewController delegate.
Key Changes
- Added runtime check in ShouldSelectViewController to prevent selection of disabled tabs
- Applied initial IsEnabled state when tab items are created or the collection changes
- Added UI test to verify the fix works correctly
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs | Adds IsEnabled check in ShouldSelectViewController and applies initial enabled state for tabs in two locations |
| src/Controls/tests/TestCases.HostApp/Issues/Issue33158.cs | Creates test UI page with three tabs (first and third enabled, second disabled) to demonstrate the issue |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33158.cs | Implements NUnit test that verifies disabled tab cannot be selected and can be enabled at runtime |
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs
Show resolved
Hide resolved
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/ShellItemRenderer.cs
Outdated
Show resolved
Hide resolved
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33158.cs
Outdated
Show resolved
Hide resolved
|
/rebase |
c98f0f5 to
8443844
Compare
|
/azp run maui-pr-uitests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
PureWeen
left a comment
There was a problem hiding this comment.
This one looks good but I want to wait until we have our iOS 26 UI test lane up before we merge this. I've set it to SR4, by then we should hopefully have it merged
PureWeen
left a comment
There was a problem hiding this comment.
Can you split this into two PRs?
One that has the iOS26 changes and one that has the general changes?
That way we can at least merge the general changes for now and once we get iOS 26 UItests up we can merge the other changes
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause The load-time handling of the `IsEnabled` property for tab items was not implemented on iOS. As a result, disabled tabs could still be selectable and navigateable ### Description of Change Updated `ShellItemRenderer.cs` to set the `IsEnabled` property of each `TabBar` item based on the corresponding `IsEnabled` value during both initial creation and when the items collection changes. <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33158 ### Follow-up PR : - On **iOS 26** and **Catalyst 26**, navigation between tabs via drag and selection gestures is handled separately in this PR #33337. ### Tested the behavior in the following platforms - [ ] Windows - [x] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/d133ccd3-abb1-44dd-9135-16b1ebeeb8e6"> | <video src="https://github.com/user-attachments/assets/223f454c-fc1a-4167-b265-8ef6c7e0c8c6"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
StephaneDelcroix
left a comment
There was a problem hiding this comment.
✅ Approved
Code Review Summary:
The fix correctly addresses the iOS 26/Mac Catalyst 26 issue where disabled Shell tabs can be selected via drag gestures.
Strengths
- Minimal, surgical change (9 lines added)
- Proper version guard using
OperatingSystem.IsIOSVersionAtLeast(26) - Backwards compatible - doesn't affect iOS < 26
- Well-commented code explaining the iOS 26 behavior
- Improved variable naming (
r→renderer)
Notes
- Tests from PR #33369 (merged to
inflight/current) will cover this scenario once both merge to main - Cannot fully validate on current simulators since iOS 26 is a future version, but code logic is verified correct
- Waiting for iOS 26 UI test lane (per PureWeen's earlier comment) is the right approach
LGTM! 🚀
Changes requested have been addressed - PR was split as requested. PR #33369 (general changes) was merged, and this PR now contains only the iOS 26-specific changes.
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause The load-time handling of the `IsEnabled` property for tab items was not implemented on iOS. As a result, disabled tabs could still be selectable and navigateable ### Description of Change Updated `ShellItemRenderer.cs` to set the `IsEnabled` property of each `TabBar` item based on the corresponding `IsEnabled` value during both initial creation and when the items collection changes. <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33158 ### Follow-up PR : - On **iOS 26** and **Catalyst 26**, navigation between tabs via drag and selection gestures is handled separately in this PR #33337. ### Tested the behavior in the following platforms - [ ] Windows - [x] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/d133ccd3-abb1-44dd-9135-16b1ebeeb8e6"> | <video src="https://github.com/user-attachments/assets/223f454c-fc1a-4167-b265-8ef6c7e0c8c6"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause The load-time handling of the `IsEnabled` property for tab items was not implemented on iOS. As a result, disabled tabs could still be selectable and navigateable ### Description of Change Updated `ShellItemRenderer.cs` to set the `IsEnabled` property of each `TabBar` item based on the corresponding `IsEnabled` value during both initial creation and when the items collection changes. <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33158 ### Follow-up PR : - On **iOS 26** and **Catalyst 26**, navigation between tabs via drag and selection gestures is handled separately in this PR #33337. ### Tested the behavior in the following platforms - [ ] Windows - [x] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/d133ccd3-abb1-44dd-9135-16b1ebeeb8e6"> | <video src="https://github.com/user-attachments/assets/223f454c-fc1a-4167-b265-8ef6c7e0c8c6"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause The load-time handling of the `IsEnabled` property for tab items was not implemented on iOS. As a result, disabled tabs could still be selectable and navigateable ### Description of Change Updated `ShellItemRenderer.cs` to set the `IsEnabled` property of each `TabBar` item based on the corresponding `IsEnabled` value during both initial creation and when the items collection changes. <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33158 ### Follow-up PR : - On **iOS 26** and **Catalyst 26**, navigation between tabs via drag and selection gestures is handled separately in this PR #33337. ### Tested the behavior in the following platforms - [ ] Windows - [x] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/d133ccd3-abb1-44dd-9135-16b1ebeeb8e6"> | <video src="https://github.com/user-attachments/assets/223f454c-fc1a-4167-b265-8ef6c7e0c8c6"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
|
/azp run maui-pr-uitests |
|
/azp run maui-pr-devicetests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines successfully started running 1 pipeline(s). |
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause The load-time handling of the `IsEnabled` property for tab items was not implemented on iOS. As a result, disabled tabs could still be selectable and navigateable ### Description of Change Updated `ShellItemRenderer.cs` to set the `IsEnabled` property of each `TabBar` item based on the corresponding `IsEnabled` value during both initial creation and when the items collection changes. <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33158 ### Follow-up PR : - On **iOS 26** and **Catalyst 26**, navigation between tabs via drag and selection gestures is handled separately in this PR #33337. ### Tested the behavior in the following platforms - [ ] Windows - [x] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/d133ccd3-abb1-44dd-9135-16b1ebeeb8e6"> | <video src="https://github.com/user-attachments/assets/223f454c-fc1a-4167-b265-8ef6c7e0c8c6"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause The load-time handling of the `IsEnabled` property for tab items was not implemented on iOS. As a result, disabled tabs could still be selectable and navigateable ### Description of Change Updated `ShellItemRenderer.cs` to set the `IsEnabled` property of each `TabBar` item based on the corresponding `IsEnabled` value during both initial creation and when the items collection changes. <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33158 ### Follow-up PR : - On **iOS 26** and **Catalyst 26**, navigation between tabs via drag and selection gestures is handled separately in this PR #33337. ### Tested the behavior in the following platforms - [ ] Windows - [x] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/d133ccd3-abb1-44dd-9135-16b1ebeeb8e6"> | <video src="https://github.com/user-attachments/assets/223f454c-fc1a-4167-b265-8ef6c7e0c8c6"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause The load-time handling of the `IsEnabled` property for tab items was not implemented on iOS. As a result, disabled tabs could still be selectable and navigateable ### Description of Change Updated `ShellItemRenderer.cs` to set the `IsEnabled` property of each `TabBar` item based on the corresponding `IsEnabled` value during both initial creation and when the items collection changes. <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33158 ### Follow-up PR : - On **iOS 26** and **Catalyst 26**, navigation between tabs via drag and selection gestures is handled separately in this PR #33337. ### Tested the behavior in the following platforms - [ ] Windows - [x] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/d133ccd3-abb1-44dd-9135-16b1ebeeb8e6"> | <video src="https://github.com/user-attachments/assets/223f454c-fc1a-4167-b265-8ef6c7e0c8c6"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
<!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause The load-time handling of the `IsEnabled` property for tab items was not implemented on iOS. As a result, disabled tabs could still be selectable and navigateable ### Description of Change Updated `ShellItemRenderer.cs` to set the `IsEnabled` property of each `TabBar` item based on the corresponding `IsEnabled` value during both initial creation and when the items collection changes. <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #33158 ### Follow-up PR : - On **iOS 26** and **Catalyst 26**, navigation between tabs via drag and selection gestures is handled separately in this PR #33337. ### Tested the behavior in the following platforms - [ ] Windows - [x] Android - [x] iOS - [x] Mac | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/d133ccd3-abb1-44dd-9135-16b1ebeeb8e6"> | <video src="https://github.com/user-attachments/assets/223f454c-fc1a-4167-b265-8ef6c7e0c8c6"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
dotnet#33337) <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Root Cause On iOS and Mac Catalyst 26 version, drag and selection gestures allow navigation to disabled tabs which leads to inconsistent with the UI and expected behavior. ### Description of Change * Since navigation can be achieved via drag and select in iOS and Mac Catalyst version 26, updated the `ShouldSelectViewController` logic in `ShellItemRenderer.cs` to prevent selection of disabled tabs on iOS and Mac Catalyst by returning `false` when a tab's `IsEnabled` property is `false`. <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes dotnet#33158 ### Tested the behavior in the following platforms - [ ] Windows - [x] Android - [x] iOS - [x] Mac Follow UP PR : [33369](dotnet#33369) | Before Issue Fix | After Issue Fix | |----------|----------| | <video src="https://github.com/user-attachments/assets/837f9197-4f92-4797-8b4a-5f40cc0f2af2"> | <video src="https://github.com/user-attachments/assets/89449bc0-bd23-4f10-8bbd-102cce85f64e"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
Root Cause
On iOS and Mac Catalyst 26 version, drag and selection gestures allow navigation to disabled tabs which leads to inconsistent with the UI and expected behavior.
Description of Change
ShouldSelectViewControllerlogic inShellItemRenderer.csto prevent selection of disabled tabs on iOS and Mac Catalyst by returningfalsewhen a tab'sIsEnabledproperty isfalse.Issues Fixed
Fixes #33158
Tested the behavior in the following platforms
Follow UP PR : 33369
Screen.Recording.2026-01-05.at.15.49.31.mov
Screen.Recording.2026-01-05.at.16.00.54.mov