[Android] Fixed CollectionView reordering last item#17825
[Android] Fixed CollectionView reordering last item#17825jfversluis merged 5 commits intodotnet:inflight/currentfrom
Conversation
|
Hey there @vitalii-vov! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
src/Controls/src/Core/Handlers/Items/Android/Adapters/ReorderableItemsViewAdapter.cs
Outdated
Show resolved
Hide resolved
|
@vitalii-vov Can you add a unit test for this? |
|
@rmarinho |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
jsuarezruiz
left a comment
There was a problem hiding this comment.
Could you share a sample where could reproduce the issue before the changes?. I would use it to validate in addition to update the PR adding an UI Test.
|
Hello, Another example is just add <CollectionView.Header>
<Label Text="Hello"/>
</CollectionView.Header>to your CollectionView |
|
Hello, The base of this fix is already visible on lines 36 and 41. Author just recreated fix used in the situation where "IsGrouped == true && Header != null" the same way for case where "IsGrouped = false && Header != null". I've already tested this and I am currently using it in project the hard way (recreating classes and overriding methods). This can solve application crashing for ppl using Header or HeaderTemplate and not using IsGrouped at the same time so from the base of logic this should be free fix even for testing. Video - TestingPR17825-2.webmStarts with No Fix Fixed Thanks, |
|
/rebase |
rmarinho
left a comment
There was a problem hiding this comment.
We need to rebase, but also add a test for this issue.
@jfversluis do you know if we have any reorder test ?
|
/rebase |
|
Needs rebase and add a test |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Azure Pipelines successfully started running 1 pipeline(s). |
🤖 PR Agent Review📊 Expand Full ReviewStatus: ✅ APPROVE
🔍 Phase 1: Pre-Flight — Context & Validation📝 Review Session — Improved the UiTest ·
|
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #17825 | Uses itemsSource.HasHeader to calculate source indices by offsetting adapter positions when header present |
✅ PASS (Gate) | ReorderableItemsViewAdapter.cs (+7-3) | Original PR - follows existing pattern for grouped scenario (lines 33, 38) |
Fix Details (PR's approach):
- Retrieves
hasHeaderfromitemsSource.HasHeader(existing property) - Calculates
fromPositionInSourceandtoPositionInSourceby subtracting 1 if header present - Uses source indices for IList operations (RemoveAt, Insert)
- Uses adapter positions for NotifyItemMoved (visual update)
Alternative Approaches Considered:
-
Track header in OnMove method parameters ❌
- Would require changing interface signatures
- More invasive than current fix
- Rejected: Too complex for the scope of the fix
-
Adjust indices in caller (SimpleItemTouchHelperCallback) ❌
- Would violate separation of concerns
- Callback shouldn't know about adapter internal structure
- Rejected: Wrong architectural layer
-
Override ItemCount to exclude header ❌
- Would break RecyclerView rendering
- Header wouldn't display correctly
- Rejected: Breaks existing functionality
Analysis:
- PR's fix is mathematically correct:
adapter_position (includes header) - 1 = source_position (items only) - Mirrors existing pattern for grouped CollectionView case (same file, lines 33-38)
- Community member @Domik234 independently implemented identical fix (Jul 2024)
- Only 4 lines changed in single file - focused and minimal
Exhausted: Yes (tried-fix not needed - PR fix is clearly optimal)
Selected Fix: PR's fix - Simplest correct solution that mirrors existing codebase pattern
📋 Phase 5: Report — Final Recommendation
No review sessions yet
|
/rebase |
Fixed CollectionView reordering last item Add test case and XAML for CollectionView reordering with header support Replace ClassicAssert with Assert.That in CollectionView reordering test for consistency Phase 1 (Pre-Flight): Document PR dotnet#17825 context Phase 2-3 (Tests/Gate): Tests compile, Gate blocked by infrastructure Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>
|
I've also modified the description a bit based on the pr-finalizer recommendation |
|
@vitalii-vov sorry this took a while, but we are happy to merge this now! However, we do need you to sign the CLA agreement. If you're still willing and able to do that, can you please follow the instructions here: #17825 (comment) Thank you! We'd be happy to name you a .NET MAUI contributor! |
|
@dotnet-policy-service agree |
…est for consistency
jfversluis
left a comment
There was a problem hiding this comment.
Thank you so much @vitalii-vov! Go update your LinkedIn with proud .NET MAUI contributor now!
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Fixed application crash when dragging an element to the end of a CollectionView with a header on Android. **Root cause:** Android's RecyclerView adapter includes the header at position 0, offsetting all item positions by 1. When reordering items, the code was using adapter positions directly to access the ItemsSource (which doesn't include the header), causing an ArgumentOutOfRangeException. **Fix:** Added header offset calculation when accessing ItemsSource indices: - Uses existing `itemsSource.HasHeader` property to detect header presence - Calculates source indices by subtracting 1 from adapter positions when header is present - Mirrors the existing pattern used for grouped CollectionView (lines 33-38) **Key insight:** RecyclerView adapter indices (includes header) ≠ ItemsSource indices (items only). Must translate between these two index spaces when reordering. **Files changed:** - `ReorderableItemsViewAdapter.cs` - Added header offset calculation (+7 -3 lines) - Test files - Added UI tests to verify fix prevents crash ### Issues Fixed Fixes #17823 --- ## Comparison with Current Description ### Current (Minimal but Accurate) ```markdown ### Description of Change Fixed application crash when dragging an element to the end of a collection on Android. ### Issues Fixed Fixes #17823 ``` ### What's Added 1. ✅ **Required NOTE block** - Enables community testing of artifacts 2. ✅ **Root cause explanation** - Helps future maintainers understand why the bug occurred 3. ✅ **Fix approach details** - Documents the solution pattern for similar issues 4. ✅ **Key insight** - Captures the fundamental concept (index space translation) 5. ✅ **File changes summary** - Quick overview of what was modified ### Why This Matters - **For future agents**: Clear context about the adapter vs. source index pattern - **For community**: Ability to test artifacts before merge - **For maintainers**: Understanding of the fix without reading code - **For similar issues**: Pattern to follow (already used for grouped CollectionView) --- ## Usage Copy the "Enhanced Description with Context" section above and paste it into the PR description on GitHub. The current description is functionally correct - this enhancement adds valuable context without changing accuracy. --------- Co-authored-by: vitvov <vitvov@hotmail.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Fixed application crash when dragging an element to the end of a CollectionView with a header on Android. **Root cause:** Android's RecyclerView adapter includes the header at position 0, offsetting all item positions by 1. When reordering items, the code was using adapter positions directly to access the ItemsSource (which doesn't include the header), causing an ArgumentOutOfRangeException. **Fix:** Added header offset calculation when accessing ItemsSource indices: - Uses existing `itemsSource.HasHeader` property to detect header presence - Calculates source indices by subtracting 1 from adapter positions when header is present - Mirrors the existing pattern used for grouped CollectionView (lines 33-38) **Key insight:** RecyclerView adapter indices (includes header) ≠ ItemsSource indices (items only). Must translate between these two index spaces when reordering. **Files changed:** - `ReorderableItemsViewAdapter.cs` - Added header offset calculation (+7 -3 lines) - Test files - Added UI tests to verify fix prevents crash ### Issues Fixed Fixes #17823 --- ## Comparison with Current Description ### Current (Minimal but Accurate) ```markdown ### Description of Change Fixed application crash when dragging an element to the end of a collection on Android. ### Issues Fixed Fixes #17823 ``` ### What's Added 1. ✅ **Required NOTE block** - Enables community testing of artifacts 2. ✅ **Root cause explanation** - Helps future maintainers understand why the bug occurred 3. ✅ **Fix approach details** - Documents the solution pattern for similar issues 4. ✅ **Key insight** - Captures the fundamental concept (index space translation) 5. ✅ **File changes summary** - Quick overview of what was modified ### Why This Matters - **For future agents**: Clear context about the adapter vs. source index pattern - **For community**: Ability to test artifacts before merge - **For maintainers**: Understanding of the fix without reading code - **For similar issues**: Pattern to follow (already used for grouped CollectionView) --- ## Usage Copy the "Enhanced Description with Context" section above and paste it into the PR description on GitHub. The current description is functionally correct - this enhancement adds valuable context without changing accuracy. --------- Co-authored-by: vitvov <vitvov@hotmail.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Fixed application crash when dragging an element to the end of a CollectionView with a header on Android. **Root cause:** Android's RecyclerView adapter includes the header at position 0, offsetting all item positions by 1. When reordering items, the code was using adapter positions directly to access the ItemsSource (which doesn't include the header), causing an ArgumentOutOfRangeException. **Fix:** Added header offset calculation when accessing ItemsSource indices: - Uses existing `itemsSource.HasHeader` property to detect header presence - Calculates source indices by subtracting 1 from adapter positions when header is present - Mirrors the existing pattern used for grouped CollectionView (lines 33-38) **Key insight:** RecyclerView adapter indices (includes header) ≠ ItemsSource indices (items only). Must translate between these two index spaces when reordering. **Files changed:** - `ReorderableItemsViewAdapter.cs` - Added header offset calculation (+7 -3 lines) - Test files - Added UI tests to verify fix prevents crash ### Issues Fixed Fixes #17823 --- ## Comparison with Current Description ### Current (Minimal but Accurate) ```markdown ### Description of Change Fixed application crash when dragging an element to the end of a collection on Android. ### Issues Fixed Fixes #17823 ``` ### What's Added 1. ✅ **Required NOTE block** - Enables community testing of artifacts 2. ✅ **Root cause explanation** - Helps future maintainers understand why the bug occurred 3. ✅ **Fix approach details** - Documents the solution pattern for similar issues 4. ✅ **Key insight** - Captures the fundamental concept (index space translation) 5. ✅ **File changes summary** - Quick overview of what was modified ### Why This Matters - **For future agents**: Clear context about the adapter vs. source index pattern - **For community**: Ability to test artifacts before merge - **For maintainers**: Understanding of the fix without reading code - **For similar issues**: Pattern to follow (already used for grouped CollectionView) --- ## Usage Copy the "Enhanced Description with Context" section above and paste it into the PR description on GitHub. The current description is functionally correct - this enhancement adds valuable context without changing accuracy. --------- Co-authored-by: vitvov <vitvov@hotmail.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Fixed application crash when dragging an element to the end of a CollectionView with a header on Android. **Root cause:** Android's RecyclerView adapter includes the header at position 0, offsetting all item positions by 1. When reordering items, the code was using adapter positions directly to access the ItemsSource (which doesn't include the header), causing an ArgumentOutOfRangeException. **Fix:** Added header offset calculation when accessing ItemsSource indices: - Uses existing `itemsSource.HasHeader` property to detect header presence - Calculates source indices by subtracting 1 from adapter positions when header is present - Mirrors the existing pattern used for grouped CollectionView (lines 33-38) **Key insight:** RecyclerView adapter indices (includes header) ≠ ItemsSource indices (items only). Must translate between these two index spaces when reordering. **Files changed:** - `ReorderableItemsViewAdapter.cs` - Added header offset calculation (+7 -3 lines) - Test files - Added UI tests to verify fix prevents crash ### Issues Fixed Fixes #17823 --- ## Comparison with Current Description ### Current (Minimal but Accurate) ```markdown ### Description of Change Fixed application crash when dragging an element to the end of a collection on Android. ### Issues Fixed Fixes #17823 ``` ### What's Added 1. ✅ **Required NOTE block** - Enables community testing of artifacts 2. ✅ **Root cause explanation** - Helps future maintainers understand why the bug occurred 3. ✅ **Fix approach details** - Documents the solution pattern for similar issues 4. ✅ **Key insight** - Captures the fundamental concept (index space translation) 5. ✅ **File changes summary** - Quick overview of what was modified ### Why This Matters - **For future agents**: Clear context about the adapter vs. source index pattern - **For community**: Ability to test artifacts before merge - **For maintainers**: Understanding of the fix without reading code - **For similar issues**: Pattern to follow (already used for grouped CollectionView) --- ## Usage Copy the "Enhanced Description with Context" section above and paste it into the PR description on GitHub. The current description is functionally correct - this enhancement adds valuable context without changing accuracy. --------- Co-authored-by: vitvov <vitvov@hotmail.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Fixed application crash when dragging an element to the end of a CollectionView with a header on Android. **Root cause:** Android's RecyclerView adapter includes the header at position 0, offsetting all item positions by 1. When reordering items, the code was using adapter positions directly to access the ItemsSource (which doesn't include the header), causing an ArgumentOutOfRangeException. **Fix:** Added header offset calculation when accessing ItemsSource indices: - Uses existing `itemsSource.HasHeader` property to detect header presence - Calculates source indices by subtracting 1 from adapter positions when header is present - Mirrors the existing pattern used for grouped CollectionView (lines 33-38) **Key insight:** RecyclerView adapter indices (includes header) ≠ ItemsSource indices (items only). Must translate between these two index spaces when reordering. **Files changed:** - `ReorderableItemsViewAdapter.cs` - Added header offset calculation (+7 -3 lines) - Test files - Added UI tests to verify fix prevents crash ### Issues Fixed Fixes #17823 --- ## Comparison with Current Description ### Current (Minimal but Accurate) ```markdown ### Description of Change Fixed application crash when dragging an element to the end of a collection on Android. ### Issues Fixed Fixes #17823 ``` ### What's Added 1. ✅ **Required NOTE block** - Enables community testing of artifacts 2. ✅ **Root cause explanation** - Helps future maintainers understand why the bug occurred 3. ✅ **Fix approach details** - Documents the solution pattern for similar issues 4. ✅ **Key insight** - Captures the fundamental concept (index space translation) 5. ✅ **File changes summary** - Quick overview of what was modified ### Why This Matters - **For future agents**: Clear context about the adapter vs. source index pattern - **For community**: Ability to test artifacts before merge - **For maintainers**: Understanding of the fix without reading code - **For similar issues**: Pattern to follow (already used for grouped CollectionView) --- ## Usage Copy the "Enhanced Description with Context" section above and paste it into the PR description on GitHub. The current description is functionally correct - this enhancement adds valuable context without changing accuracy. --------- Co-authored-by: vitvov <vitvov@hotmail.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Fixed application crash when dragging an element to the end of a CollectionView with a header on Android. **Root cause:** Android's RecyclerView adapter includes the header at position 0, offsetting all item positions by 1. When reordering items, the code was using adapter positions directly to access the ItemsSource (which doesn't include the header), causing an ArgumentOutOfRangeException. **Fix:** Added header offset calculation when accessing ItemsSource indices: - Uses existing `itemsSource.HasHeader` property to detect header presence - Calculates source indices by subtracting 1 from adapter positions when header is present - Mirrors the existing pattern used for grouped CollectionView (lines 33-38) **Key insight:** RecyclerView adapter indices (includes header) ≠ ItemsSource indices (items only). Must translate between these two index spaces when reordering. **Files changed:** - `ReorderableItemsViewAdapter.cs` - Added header offset calculation (+7 -3 lines) - Test files - Added UI tests to verify fix prevents crash ### Issues Fixed Fixes #17823 --- ## Comparison with Current Description ### Current (Minimal but Accurate) ```markdown ### Description of Change Fixed application crash when dragging an element to the end of a collection on Android. ### Issues Fixed Fixes #17823 ``` ### What's Added 1. ✅ **Required NOTE block** - Enables community testing of artifacts 2. ✅ **Root cause explanation** - Helps future maintainers understand why the bug occurred 3. ✅ **Fix approach details** - Documents the solution pattern for similar issues 4. ✅ **Key insight** - Captures the fundamental concept (index space translation) 5. ✅ **File changes summary** - Quick overview of what was modified ### Why This Matters - **For future agents**: Clear context about the adapter vs. source index pattern - **For community**: Ability to test artifacts before merge - **For maintainers**: Understanding of the fix without reading code - **For similar issues**: Pattern to follow (already used for grouped CollectionView) --- ## Usage Copy the "Enhanced Description with Context" section above and paste it into the PR description on GitHub. The current description is functionally correct - this enhancement adds valuable context without changing accuracy. --------- Co-authored-by: vitvov <vitvov@hotmail.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Fixed application crash when dragging an element to the end of a CollectionView with a header on Android. **Root cause:** Android's RecyclerView adapter includes the header at position 0, offsetting all item positions by 1. When reordering items, the code was using adapter positions directly to access the ItemsSource (which doesn't include the header), causing an ArgumentOutOfRangeException. **Fix:** Added header offset calculation when accessing ItemsSource indices: - Uses existing `itemsSource.HasHeader` property to detect header presence - Calculates source indices by subtracting 1 from adapter positions when header is present - Mirrors the existing pattern used for grouped CollectionView (lines 33-38) **Key insight:** RecyclerView adapter indices (includes header) ≠ ItemsSource indices (items only). Must translate between these two index spaces when reordering. **Files changed:** - `ReorderableItemsViewAdapter.cs` - Added header offset calculation (+7 -3 lines) - Test files - Added UI tests to verify fix prevents crash ### Issues Fixed Fixes #17823 --- ## Comparison with Current Description ### Current (Minimal but Accurate) ```markdown ### Description of Change Fixed application crash when dragging an element to the end of a collection on Android. ### Issues Fixed Fixes #17823 ``` ### What's Added 1. ✅ **Required NOTE block** - Enables community testing of artifacts 2. ✅ **Root cause explanation** - Helps future maintainers understand why the bug occurred 3. ✅ **Fix approach details** - Documents the solution pattern for similar issues 4. ✅ **Key insight** - Captures the fundamental concept (index space translation) 5. ✅ **File changes summary** - Quick overview of what was modified ### Why This Matters - **For future agents**: Clear context about the adapter vs. source index pattern - **For community**: Ability to test artifacts before merge - **For maintainers**: Understanding of the fix without reading code - **For similar issues**: Pattern to follow (already used for grouped CollectionView) --- ## Usage Copy the "Enhanced Description with Context" section above and paste it into the PR description on GitHub. The current description is functionally correct - this enhancement adds valuable context without changing accuracy. --------- Co-authored-by: vitvov <vitvov@hotmail.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Fixed application crash when dragging an element to the end of a CollectionView with a header on Android. **Root cause:** Android's RecyclerView adapter includes the header at position 0, offsetting all item positions by 1. When reordering items, the code was using adapter positions directly to access the ItemsSource (which doesn't include the header), causing an ArgumentOutOfRangeException. **Fix:** Added header offset calculation when accessing ItemsSource indices: - Uses existing `itemsSource.HasHeader` property to detect header presence - Calculates source indices by subtracting 1 from adapter positions when header is present - Mirrors the existing pattern used for grouped CollectionView (lines 33-38) **Key insight:** RecyclerView adapter indices (includes header) ≠ ItemsSource indices (items only). Must translate between these two index spaces when reordering. **Files changed:** - `ReorderableItemsViewAdapter.cs` - Added header offset calculation (+7 -3 lines) - Test files - Added UI tests to verify fix prevents crash ### Issues Fixed Fixes #17823 --- ## Comparison with Current Description ### Current (Minimal but Accurate) ```markdown ### Description of Change Fixed application crash when dragging an element to the end of a collection on Android. ### Issues Fixed Fixes #17823 ``` ### What's Added 1. ✅ **Required NOTE block** - Enables community testing of artifacts 2. ✅ **Root cause explanation** - Helps future maintainers understand why the bug occurred 3. ✅ **Fix approach details** - Documents the solution pattern for similar issues 4. ✅ **Key insight** - Captures the fundamental concept (index space translation) 5. ✅ **File changes summary** - Quick overview of what was modified ### Why This Matters - **For future agents**: Clear context about the adapter vs. source index pattern - **For community**: Ability to test artifacts before merge - **For maintainers**: Understanding of the fix without reading code - **For similar issues**: Pattern to follow (already used for grouped CollectionView) --- ## Usage Copy the "Enhanced Description with Context" section above and paste it into the PR description on GitHub. The current description is functionally correct - this enhancement adds valuable context without changing accuracy. --------- Co-authored-by: vitvov <vitvov@hotmail.com> Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
.NET MAUI inflight/candidate introduces significant improvements across all platforms with focus on quality, performance, and developer experience. This release includes 20 commits with various improvements, bug fixes, and enhancements. ## Blazor - Fix for BlazorWebView Back Navigation Issues on Android 13+ After Predictive Back Gesture Changes by @SuthiYuvaraj in #33213 <details> <summary>🔧 Fixes</summary> - [Back navigation different between .net 9 and .net 10 blazor hybrid](#32767) </details> ## CollectionView - [Android] Fix for CollectionView.EmptyView does not remeasure its height when the parent layout changes dynamically, causing incorrect sizing. by @BagavathiPerumal in #33559 <details> <summary>🔧 Fixes</summary> - [`CollectionView.EmptyView` does not remeasure its height when the parent layout changes dynamically, causing incorrect sizing.](#33324) </details> - [Android] Fixed CollectionView reordering last item by @vitalii-vov in #17825 <details> <summary>🔧 Fixes</summary> - [Android app crashes when dragging into CollectionView](#17823) </details> ## DateTimePicker - [iOS] Fix VoiceOver focus not shifting to Picker/DatePicker/TimePicker popups by @kubaflo in #33152 <details> <summary>🔧 Fixes</summary> - [Voiceover does not automatically shift focus to the "Category" popup when it opens.: A11y_Developer balance version .NET 10_Project_ScreenReader](#30746) </details> ## Dialogalert - [iOS 26] Fix DisplayPromptAsync maxLength not enforced due to new multi-range delegate by @Shalini-Ashokan in #33616 <details> <summary>🔧 Fixes</summary> - [[iOS 26.1] DisplayPromptAsync ignores maxLength and does not respect RTL FlowDirection](#33549) </details> ## Flyout - [iOS] Shell: Account for SafeArea when positioning flyout footer by @kubaflo in #32891 <details> <summary>🔧 Fixes</summary> - [[IOS] Footer not displaying in iOS when StackOrientation.Horizontal is set on FlyoutFooter](#26395) </details> ## Fonts - Hide obsolete FontSize values from IDE autocomplete by @noiseonwires in #33694 ## Gestures - Android pan fixes by @BurningLights in #21547 <details> <summary>🔧 Fixes</summary> - [Flickering occurs while updating the width of ContentView through PanGestureRecognizer.](#20772) </details> ## Navigation - Shell: Add duplicate route validation for sibling elements by @SubhikshaSf4851 in #32296 <details> <summary>🔧 Fixes</summary> - [OnNavigatedTo is not called when navigating from a specific page](#14000) </details> ## Picker - Improved Unfocus support for Picker on Mac Catalyst by @kubaflo in #33127 <details> <summary>🔧 Fixes</summary> - [When using voiceover unable to access expanded list of project combo box: A11y_.NET maui_user can creat a tak_Screen reader](#30897) - [Task and Project controls are not accessible with keyboard:A11y_.NET maui_User can create a new task_Keyboard](#30891) </details> ## SafeArea - [iOS] SafeArea: Return Empty for non-ISafeAreaView views (opt-in model) by @praveenkumarkarunanithi in #33526 <details> <summary>🔧 Fixes</summary> - [[iOS] SafeArea is not applied when a ContentPage uses a ControlTemplate](#33458) </details> ## Shell - [iOS] Fix ObjectDisposedException in TraitCollectionDidChange on window disposal by @jeremy-visionaid in #33353 <details> <summary>🔧 Fixes</summary> - [Intermittent crash on exit on MacCatalyst - ObjectDisposedException](#33352) </details> - [Issue-Resolver] Explicit fallback for BackButtonBehavior lookup by @kubaflo in #33204 <details> <summary>🔧 Fixes</summary> - [Setting BackButtonBehavior to not visible or not enabled does not work](#28570) - [BackButtonBehavior not bound](#33139) </details> ## Templates - [Templates] Remove redundant SemanticProperties.Description attribute by @kubaflo in #33621 <details> <summary>🔧 Fixes</summary> - [Task and Project controls are not accessible with keyboard:A11y_.NET maui_User can create a new task_Keyboard](#30891) - [Unable to select "Tags" when Voiceover is turned on.: A11y_Developer balance version .NET 10_Project_ScreenReader](#30749) </details> ## Theme - [Windows] Fix runtime theme update for controls and TitleBar by @Tamilarasan-Paranthaman in #31714 <details> <summary>🔧 Fixes</summary> - [[Windows][MacOS?] Change title bar color when switching light/dark theme at runtime](#12507) - [OS system components ignore app theme](#22058) - [[Mac Catalyst][Windows] TitleBar not reacting on UserAppTheme changes](#30518) - [In dark theme "Back" and "hamburger" button icon color contrast with background color is less than 3:1: A11y_.NET maui_User can get all the insights of Dashboard_Non text Contrast](#30807) - [`Switch` is invisible on `PointOver` when theme has changed](#31819) </details> ## Theming - [XSG] Fix Style Setters referencing source-generated bindable properties by @simonrozsival in #33562 ## Titlebar - [Windows] Fix TitleBar.IsVisible = false the caption buttons become unresponsive by @devanathan-vaithiyanathan in #33256 <details> <summary>🔧 Fixes</summary> - [When TitleBar.IsVisible = false the caption buttons become unresponsive on Windows](#33171) </details> ## WebView - Fix WebView JavaScript string escaping for backslashes and quotes by @StephaneDelcroix in #33726 ## Xaml - [XSG] Fix NaN value in XAML generating invalid code by @StephaneDelcroix in #33533 <details> <summary>🔧 Fixes</summary> - [[XSG] NaN value in XAML generates invalid code](#33532) </details> <details> <summary>📦 Other (1)</summary> - Remove InternalsVisibleTo attributes for .NET MAUI Community Toolkit by @jfversluis via @Copilot in #33442 </details> **Full Changelog**: main...inflight/candidate
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
Fixed application crash when dragging an element to the end of a CollectionView with a header on Android.
Root cause: Android's RecyclerView adapter includes the header at position 0, offsetting all item positions by 1. When reordering items, the code was using adapter positions directly to access the ItemsSource (which doesn't include the header), causing an ArgumentOutOfRangeException.
Fix: Added header offset calculation when accessing ItemsSource indices:
itemsSource.HasHeaderproperty to detect header presenceKey insight: RecyclerView adapter indices (includes header) ≠ ItemsSource indices (items only). Must translate between these two index spaces when reordering.
Files changed:
ReorderableItemsViewAdapter.cs- Added header offset calculation (+7 -3 lines)Issues Fixed
Fixes #17823
Comparison with Current Description
Current (Minimal but Accurate)
What's Added
Why This Matters
Usage
Copy the "Enhanced Description with Context" section above and paste it into the PR description on GitHub.
The current description is functionally correct - this enhancement adds valuable context without changing accuracy.