[Android] ScrollView - Setting SetClipChildren to false#26475
[Android] ScrollView - Setting SetClipChildren to false#26475kubaflo merged 4 commits intodotnet:inflight/currentfrom
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where shadows on UI elements inside ScrollViews were being clipped on Android. The fix involves setting SetClipChildren(false) on the padding shim container to allow shadow effects to render outside the bounds of their parent container.
- Adds
SetClipChildren(false)to the padding shim in ScrollView handler for Android - Includes comprehensive UI test implementation to verify shadow rendering works correctly
- Addresses the specific case where Grid shadows were not visible within ScrollViews
Reviewed Changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Core/src/Handlers/ScrollView/ScrollViewHandler.Android.cs | Adds SetClipChildren(false) to prevent shadow clipping in ScrollView |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue20922.cs | NUnit test to verify shadow visibility in ScrollView |
| src/Controls/tests/TestCases.HostApp/Issues/Issue20922.cs | Host app test page with Grid shadow inside ScrollView |
| [Category(UITestCategories.ScrollView)] | ||
| public void ShadowShouldWork() | ||
| { | ||
| App.WaitForElement("Grid"); |
There was a problem hiding this comment.
The test is waiting for an element with AutomationId "Grid" but the actual AutomationId in the HostApp is "Grid". While this matches, the test description mentions "Border" in the PR description example, but the actual implementation uses Grid. Ensure the AutomationIds are consistent between the test case and the HostApp implementation.
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 26475Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 26475" |
|
/azp run maui-pr-uitest, maui-pr-devicetests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
StephaneDelcroix
left a comment
There was a problem hiding this comment.
Multi-Model Consensus Review -- Follow-up Note
Status: ✅ Approved & auto-merge enabled
This PR was approved and has auto-merge (squash) enabled. For completeness, here are the minor findings from our multi-model review:
🟡 MODERATE ScrollViewHandler.Android.cs:244 -- paddingShim.SetClipChildren(false) is applied unconditionally to all ScrollViews, not just those with shadows. This disables Android's display-list clipping optimization globally, increasing overdraw. Consider scoping to only apply when content has elevation/shadow in a future follow-up.
🟢 MINOR -- SetClipToPadding(false) may also be needed for complete shadow rendering near padded edges. And the outer MauiScrollView viewport may still clip overflow since only the inner paddingShim is addressed.
These are non-blocking observations for future consideration. The fix is a net improvement for the targeted shadow-clipping bug.
StephaneDelcroix
left a comment
There was a problem hiding this comment.
Multi-Model Consensus Review -- Follow-up Note
Status: ✅ Approved & auto-merge enabled
This PR was approved and has auto-merge (squash) enabled. For completeness, here are the minor findings from our multi-model review:
🟡 MODERATE ScrollViewHandler.Android.cs:244 -- paddingShim.SetClipChildren(false) is applied unconditionally to all ScrollViews, not just those with shadows. This disables Android's display-list clipping optimization globally, increasing overdraw. Consider scoping to only apply when content has elevation/shadow in a future follow-up.
🟢 MINOR -- SetClipToPadding(false) may also be needed for complete shadow rendering near padded edges. And the outer MauiScrollView viewport may still clip overflow since only the inner paddingShim is addressed.
These are non-blocking observations for future consideration. The fix is a net improvement for the targeted shadow-clipping bug.
jfversluis
left a comment
There was a problem hiding this comment.
Build errors and all kinds of unrelated files in this PR @kubaflo
|
Hi @@kubaflo. We have added the "s/pr-needs-author-input" label to this issue, which indicates that we have an open question/action for you before we can take further action. This PRwill be closed automatically in 14 days if we do not hear back from you by then - please feel free to re-open it if you come back to this PR after that time. |
0bba31b to
627b389
Compare
|
/azp run maui-pr-uitests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
## Description Remove the "Are you waiting for the changes in this PR to be merged?" note from all Copilot instruction files. This note was previously required at the top of every PR description so users could find instructions on how to test PR artifacts. We now have a **dogfooding comment bot** that automatically posts testing instructions under each PR, making this manual note redundant. Copilot agents were still prepending this note to every PR description because it was hardcoded in: - `.github/copilot-instructions.md` (main instructions) - `.github/skills/pr-finalize/SKILL.md` (PR finalization skill) - `.github/skills/pr-finalize/references/complete-example.md` (example PR) ### Issues Fixed N/A — instruction cleanup only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
/azp run maui-pr-uitests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run maui-pr-uitests |
|
Command 'run-maui-pr-uitests' is not supported by Azure Pipelines. Supported commands
See additional documentation. |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Address review feedback: - Only disable clipping when content has a shadow (avoids globally disabling Android's display-list clipping optimization) - Add SetClipToPadding(false) for complete shadow rendering near padded edges - Also disable clipping on the outer MauiScrollView viewport to prevent shadow overflow clipping Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
### Issues Fixed Fixes #20922 ``` <ScrollView> <Border HeightRequest="200" WidthRequest="200" AutomationId="Border" BackgroundColor="Red"> <Border.Shadow> <Shadow Radius="20" Brush="Gray" Offset="1,50"/> </Border.Shadow> </Border> </ScrollView> ``` |Before|After| |--|--| |<img src="https://github.com/user-attachments/assets/2d0e8e59-5b3e-4953-bc96-75658cd7555e" width="300px"/>|<img src="https://github.com/user-attachments/assets/3f31a65f-5cdc-4811-bbbe-f008af39f285" width="300px"/>| --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Issues Fixed
Fixes #20922