Repository navigation
[iOS/Mac] Keep Button caption visible when its Text changes - #40348
Conversation
A UIButtonType.System button cross-fades its title on SetTitle: the TitleLabel's alpha is set to 0 synchronously and only the fade animation's completion restores it. When that completion does not run, the caption stays invisible (Issue25074 ButtonResizesWhenTitleOrImageChanges on Mac Catalyst shows buttons with no captions). Apply the title update inside UIView.PerformWithoutAnimation so the label is never faded out, and add a device test asserting the TitleLabel keeps alpha 1 with no opacity animation after a Text change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/rebase |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
PR Test Gate
🧪 Gate analysis — click to expand⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect. No interpretable test-group summary was produced. No additional test execution is inferred. Setup did not capture a verified PR head; no commit is claimed as tested. No immutable without-fix baseline was prepared. |
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit 1dcc53c.
|
Follow-up evidence: this change also covers
Local Mac Catalyst probe: TestCases.HostApp at
Limitations: the probe measures the UIKit caption state that the screenshot captured, not a CI rerun of the UI test. Other Mac visual failures with a missing caption (VSM Entry, Shell2 ClearPlaceholder, Issue31899) show the same symptom but were not probed here. |
…stay clipped (#40353) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This is a candidate-acceptance fix for SR2 candidate PR #40116, so it targets `candidate/11.0.1xx-sr2` like the other candidate fixes (#40346, #40348, #40349, #40350). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change **Failure:** on the candidate, the Windows device test `BorderTests.BorderClipsTransformedContentToItsShape(scale: 3, rotation: 0, translationX: 0, translationY: 0, hasShadow: true)` fails in both packaged and unpackaged runs with `(50,50) was (0,0,0,0)` (expected red). The rows without a shadow pass. #40349 did not change this result. **Cause:** - `WrapperView` hosts a view's `DropShadow` in a `Rectangle` (`_shadowHost`) whose only job is to carry the composition `SpriteVisual`. That Rectangle had `Fill = Transparent`. - A filled shape (even a transparent one) has XAML content bounds. `RenderTargetBitmap` sizes its capture from the element's inner bounds (its own content bounds plus the transformed bounds of its children) and ignores composition clips. - In this test the shadowed BoxView has `Scale = 3` inside a 100×100 ellipse-clipped Border. The 84×84 shadow host under the same transform contributes 252×252 bounds at offset (76,76). The capture becomes 252×252 instead of 100×100, so pixel (50,50) falls in the transparent area outside the Border. The same view without a shadow contributes no extra bounds and captures at 100×100. - **Why it surfaced now:** `UpdateShadowAsync` awaits the alpha mask before `UpdateShadowSize`. Before #40175 the mask came from an async `RenderTargetBitmap`, so the host was still 0×0 when the test captured. Since #40175 (and #40349) the shape mask is produced synchronously, so the host is already sized when the capture runs. - The Transparent fill dates back to #570 and has no stated purpose. **Fix:** create the shadow host without a `Fill`. - A WinUI shape with no Fill and no Stroke has empty content bounds (`CShape::GenerateContentBounds`), so it no longer enlarges captures. - Its hand-in composition visual (the shadow) still renders, because WinUI does not cull elements by XAML bounds. - The host also stops being hit-testable. Hit testing now matches the same view without a shadow. Previously, the transparent host could take input for an `InputTransparent` layout with a shadow, because Windows doesn't apply `InputTransparent` to the wrapper for layouts. No tests, baselines, tolerances or waits are changed. **Validation:** - Compile check (macOS, Windows TFM): `src/Core/src/Core.csproj` with `-p:TargetFrameworks=net11.0-windows10.0.19041.0` produces exactly the same errors as the unchanged base: 40, all in XAML code-behind files, because XAML compilation is disabled on macOS. None are in `WrapperView.cs`. - Windows runtime validation runs on this PR's device-test (`maui-pr-devicetests`) and UI-test (`maui-pr-uitests`) CI. The PR stays a draft until: - the Border shadow row passes; - the other Border rows stay green; - the Windows shadow and BoxView UI tests (for example `ShadowFeatureTests` and `BoxViewFeatureTests`) stay green. ### Issues Fixed Fixes the Windows `BorderClipsTransformedContentToItsShape` shadow-row failure on the SR2 candidate (#40116). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This targets `candidate/11.0.1xx-sr2`, the branch explicitly designated for fixes to failures found on the SR2 candidate PR #40116. A maintainer decides any retargeting and the merge. ### Description of Change **Symptom.** `Issue25074.ButtonResizesWhenTitleOrImageChanges` fails on Mac Catalyst in candidate UI runs and also on `net11`: - candidate UI 1685512, run 47045068, result 100228: `Altered.png` differs by 1.14% on both the first attempt and the retry. - net11 UI 1685487, run 47044278, result 100223. - The captured screenshots show buttons with **no caption**: the caption pixels are just the button background. **Root cause.** The handler creates a `UIButtonType.System` button. When `SetTitle` changes the title, UIKit cross-fades it: - the `TitleLabel` alpha is set to `0` immediately and an `opacity` animation is added; - only that animation's completion sets the alpha back to `1`. So if the completion does not run, the caption stays invisible. **Fix.** Controls `ButtonExtensions.UpdateText` (iOS/Mac Catalyst) now applies `SetTitle` and the existing `TitleLabel.Text` assignment inside `UIView.PerformWithoutAnimation`, so the label is never faded out. `StepperExtensions` already uses the same pattern. `UpdateCharacterSpacing`/`SetAttributedTitle` still runs afterwards, unchanged, and the tracing showed it does not fade. **Not changed.** Core `src/Core/src/Platform/iOS/ButtonExtensions.cs` `UpdateText` is left as is. It is only used by non-Controls `IButton` implementations, because Controls `Button` maps Text through the Controls extension. **Test.** New iOS/Mac Catalyst device test `ButtonTests.TextChangeKeepsTitleLabelVisible`. It adds a Button to a window, changes its `Text`, then asserts that `TitleLabel.Alpha == 1` and that the label has no `opacity` animation. All existing assertions and oracles are unchanged; no screenshot baselines, tolerances or masks were touched. ### Validation Mac Catalyst HostApp, Issue25074 page, 40 iterations per run. Each run samples the caption labels of B1–B4 and B9 at 50 ms after the change: 5 buttons × 40 iterations = 200 samples. | Run | Product code | Faded captions (alpha 0) | | --- | --- | --- | | Baseline | unchanged | **200/200** | | Fix | `PerformWithoutAnimation` | **0/200** | | Fix reverted | unchanged | **200/200** | | Fix restored | `PerformWithoutAnimation` | **0/200** | iOS device tests on the iOS 26.0 simulator, using `xharness apple test` with `TestFilter=Category=Button`: | Run | Result | | --- | --- | | With the fix | 23/23 passed, including `TextChangeKeepsTitleLabelVisible` | | Fix reverted (test kept) | 22/23 passed; `TextChangeKeepsTitleLabelVisible` fails with `Expected: 1, Actual: 0` (alpha) | | Fix restored | 23/23 passed | The existing `TextUpdatesAttributedTitleWhenCharacterSpacingApplied` test (#40189) passes in all three runs. `dotnet format whitespace --folder --verify-no-changes` on both changed files reports no changes. **Limitations** - Local validation used Xcode 27.2; the repo pins Xcode 27.0. - The fix removes the alpha-0 state that matches the CI screenshots in every sample. Why the fade's completion does not run in CI is not proven. - This PR does not claim any other Mac visual failure is fixed. The UI test will be confirmed by this PR's own CI. ### Issues Fixed Fixes the `Issue25074.ButtonResizesWhenTitleOrImageChanges` Mac Catalyst failure observed on #40116. No separate issue was filed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…stay clipped (#40353) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This is a candidate-acceptance fix for SR2 candidate PR #40116, so it targets `candidate/11.0.1xx-sr2` like the other candidate fixes (#40346, #40348, #40349, #40350). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change **Failure:** on the candidate, the Windows device test `BorderTests.BorderClipsTransformedContentToItsShape(scale: 3, rotation: 0, translationX: 0, translationY: 0, hasShadow: true)` fails in both packaged and unpackaged runs with `(50,50) was (0,0,0,0)` (expected red). The rows without a shadow pass. #40349 did not change this result. **Cause:** - `WrapperView` hosts a view's `DropShadow` in a `Rectangle` (`_shadowHost`) whose only job is to carry the composition `SpriteVisual`. That Rectangle had `Fill = Transparent`. - A filled shape (even a transparent one) has XAML content bounds. `RenderTargetBitmap` sizes its capture from the element's inner bounds (its own content bounds plus the transformed bounds of its children) and ignores composition clips. - In this test the shadowed BoxView has `Scale = 3` inside a 100×100 ellipse-clipped Border. The 84×84 shadow host under the same transform contributes 252×252 bounds at offset (76,76). The capture becomes 252×252 instead of 100×100, so pixel (50,50) falls in the transparent area outside the Border. The same view without a shadow contributes no extra bounds and captures at 100×100. - **Why it surfaced now:** `UpdateShadowAsync` awaits the alpha mask before `UpdateShadowSize`. Before #40175 the mask came from an async `RenderTargetBitmap`, so the host was still 0×0 when the test captured. Since #40175 (and #40349) the shape mask is produced synchronously, so the host is already sized when the capture runs. - The Transparent fill dates back to #570 and has no stated purpose. **Fix:** create the shadow host without a `Fill`. - A WinUI shape with no Fill and no Stroke has empty content bounds (`CShape::GenerateContentBounds`), so it no longer enlarges captures. - Its hand-in composition visual (the shadow) still renders, because WinUI does not cull elements by XAML bounds. - The host also stops being hit-testable. Hit testing now matches the same view without a shadow. Previously, the transparent host could take input for an `InputTransparent` layout with a shadow, because Windows doesn't apply `InputTransparent` to the wrapper for layouts. No tests, baselines, tolerances or waits are changed. **Validation:** - Compile check (macOS, Windows TFM): `src/Core/src/Core.csproj` with `-p:TargetFrameworks=net11.0-windows10.0.19041.0` produces exactly the same errors as the unchanged base: 40, all in XAML code-behind files, because XAML compilation is disabled on macOS. None are in `WrapperView.cs`. - Windows runtime validation runs on this PR's device-test (`maui-pr-devicetests`) and UI-test (`maui-pr-uitests`) CI. The PR stays a draft until: - the Border shadow row passes; - the other Border rows stay green; - the Windows shadow and BoxView UI tests (for example `ShadowFeatureTests` and `BoxViewFeatureTests`) stay green. ### Issues Fixed Fixes the Windows `BorderClipsTransformedContentToItsShape` shadow-row failure on the SR2 candidate (#40116). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This targets `candidate/11.0.1xx-sr2`, the branch explicitly designated for fixes to failures found on the SR2 candidate PR #40116. A maintainer decides any retargeting and the merge. ### Description of Change **Symptom.** `Issue25074.ButtonResizesWhenTitleOrImageChanges` fails on Mac Catalyst in candidate UI runs and also on `net11`: - candidate UI 1685512, run 47045068, result 100228: `Altered.png` differs by 1.14% on both the first attempt and the retry. - net11 UI 1685487, run 47044278, result 100223. - The captured screenshots show buttons with **no caption**: the caption pixels are just the button background. **Root cause.** The handler creates a `UIButtonType.System` button. When `SetTitle` changes the title, UIKit cross-fades it: - the `TitleLabel` alpha is set to `0` immediately and an `opacity` animation is added; - only that animation's completion sets the alpha back to `1`. So if the completion does not run, the caption stays invisible. **Fix.** Controls `ButtonExtensions.UpdateText` (iOS/Mac Catalyst) now applies `SetTitle` and the existing `TitleLabel.Text` assignment inside `UIView.PerformWithoutAnimation`, so the label is never faded out. `StepperExtensions` already uses the same pattern. `UpdateCharacterSpacing`/`SetAttributedTitle` still runs afterwards, unchanged, and the tracing showed it does not fade. **Not changed.** Core `src/Core/src/Platform/iOS/ButtonExtensions.cs` `UpdateText` is left as is. It is only used by non-Controls `IButton` implementations, because Controls `Button` maps Text through the Controls extension. **Test.** New iOS/Mac Catalyst device test `ButtonTests.TextChangeKeepsTitleLabelVisible`. It adds a Button to a window, changes its `Text`, then asserts that `TitleLabel.Alpha == 1` and that the label has no `opacity` animation. All existing assertions and oracles are unchanged; no screenshot baselines, tolerances or masks were touched. ### Validation Mac Catalyst HostApp, Issue25074 page, 40 iterations per run. Each run samples the caption labels of B1–B4 and B9 at 50 ms after the change: 5 buttons × 40 iterations = 200 samples. | Run | Product code | Faded captions (alpha 0) | | --- | --- | --- | | Baseline | unchanged | **200/200** | | Fix | `PerformWithoutAnimation` | **0/200** | | Fix reverted | unchanged | **200/200** | | Fix restored | `PerformWithoutAnimation` | **0/200** | iOS device tests on the iOS 26.0 simulator, using `xharness apple test` with `TestFilter=Category=Button`: | Run | Result | | --- | --- | | With the fix | 23/23 passed, including `TextChangeKeepsTitleLabelVisible` | | Fix reverted (test kept) | 22/23 passed; `TextChangeKeepsTitleLabelVisible` fails with `Expected: 1, Actual: 0` (alpha) | | Fix restored | 23/23 passed | The existing `TextUpdatesAttributedTitleWhenCharacterSpacingApplied` test (#40189) passes in all three runs. `dotnet format whitespace --folder --verify-no-changes` on both changed files reports no changes. **Limitations** - Local validation used Xcode 27.2; the repo pins Xcode 27.0. - The fix removes the alpha-0 state that matches the CI screenshots in every sample. Why the fade's completion does not run in CI is not proven. - This PR does not claim any other Mac visual failure is fixed. The UI test will be confirmed by this PR's own CI. ### Issues Fixed Fixes the `Issue25074.ButtonResizesWhenTitleOrImageChanges` Mac Catalyst failure observed on #40116. No separate issue was filed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…stay clipped (#40353) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This is a candidate-acceptance fix for SR2 candidate PR #40116, so it targets `candidate/11.0.1xx-sr2` like the other candidate fixes (#40346, #40348, #40349, #40350). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change **Failure:** on the candidate, the Windows device test `BorderTests.BorderClipsTransformedContentToItsShape(scale: 3, rotation: 0, translationX: 0, translationY: 0, hasShadow: true)` fails in both packaged and unpackaged runs with `(50,50) was (0,0,0,0)` (expected red). The rows without a shadow pass. #40349 did not change this result. **Cause:** - `WrapperView` hosts a view's `DropShadow` in a `Rectangle` (`_shadowHost`) whose only job is to carry the composition `SpriteVisual`. That Rectangle had `Fill = Transparent`. - A filled shape (even a transparent one) has XAML content bounds. `RenderTargetBitmap` sizes its capture from the element's inner bounds (its own content bounds plus the transformed bounds of its children) and ignores composition clips. - In this test the shadowed BoxView has `Scale = 3` inside a 100×100 ellipse-clipped Border. The 84×84 shadow host under the same transform contributes 252×252 bounds at offset (76,76). The capture becomes 252×252 instead of 100×100, so pixel (50,50) falls in the transparent area outside the Border. The same view without a shadow contributes no extra bounds and captures at 100×100. - **Why it surfaced now:** `UpdateShadowAsync` awaits the alpha mask before `UpdateShadowSize`. Before #40175 the mask came from an async `RenderTargetBitmap`, so the host was still 0×0 when the test captured. Since #40175 (and #40349) the shape mask is produced synchronously, so the host is already sized when the capture runs. - The Transparent fill dates back to #570 and has no stated purpose. **Fix:** create the shadow host without a `Fill`. - A WinUI shape with no Fill and no Stroke has empty content bounds (`CShape::GenerateContentBounds`), so it no longer enlarges captures. - Its hand-in composition visual (the shadow) still renders, because WinUI does not cull elements by XAML bounds. - The host also stops being hit-testable. Hit testing now matches the same view without a shadow. Previously, the transparent host could take input for an `InputTransparent` layout with a shadow, because Windows doesn't apply `InputTransparent` to the wrapper for layouts. No tests, baselines, tolerances or waits are changed. **Validation:** - Compile check (macOS, Windows TFM): `src/Core/src/Core.csproj` with `-p:TargetFrameworks=net11.0-windows10.0.19041.0` produces exactly the same errors as the unchanged base: 40, all in XAML code-behind files, because XAML compilation is disabled on macOS. None are in `WrapperView.cs`. - Windows runtime validation runs on this PR's device-test (`maui-pr-devicetests`) and UI-test (`maui-pr-uitests`) CI. The PR stays a draft until: - the Border shadow row passes; - the other Border rows stay green; - the Windows shadow and BoxView UI tests (for example `ShadowFeatureTests` and `BoxViewFeatureTests`) stay green. ### Issues Fixed Fixes the Windows `BorderClipsTransformedContentToItsShape` shadow-row failure on the SR2 candidate (#40116). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This targets `candidate/11.0.1xx-sr2`, the branch explicitly designated for fixes to failures found on the SR2 candidate PR #40116. A maintainer decides any retargeting and the merge. ### Description of Change **Symptom.** `Issue25074.ButtonResizesWhenTitleOrImageChanges` fails on Mac Catalyst in candidate UI runs and also on `net11`: - candidate UI 1685512, run 47045068, result 100228: `Altered.png` differs by 1.14% on both the first attempt and the retry. - net11 UI 1685487, run 47044278, result 100223. - The captured screenshots show buttons with **no caption**: the caption pixels are just the button background. **Root cause.** The handler creates a `UIButtonType.System` button. When `SetTitle` changes the title, UIKit cross-fades it: - the `TitleLabel` alpha is set to `0` immediately and an `opacity` animation is added; - only that animation's completion sets the alpha back to `1`. So if the completion does not run, the caption stays invisible. **Fix.** Controls `ButtonExtensions.UpdateText` (iOS/Mac Catalyst) now applies `SetTitle` and the existing `TitleLabel.Text` assignment inside `UIView.PerformWithoutAnimation`, so the label is never faded out. `StepperExtensions` already uses the same pattern. `UpdateCharacterSpacing`/`SetAttributedTitle` still runs afterwards, unchanged, and the tracing showed it does not fade. **Not changed.** Core `src/Core/src/Platform/iOS/ButtonExtensions.cs` `UpdateText` is left as is. It is only used by non-Controls `IButton` implementations, because Controls `Button` maps Text through the Controls extension. **Test.** New iOS/Mac Catalyst device test `ButtonTests.TextChangeKeepsTitleLabelVisible`. It adds a Button to a window, changes its `Text`, then asserts that `TitleLabel.Alpha == 1` and that the label has no `opacity` animation. All existing assertions and oracles are unchanged; no screenshot baselines, tolerances or masks were touched. ### Validation Mac Catalyst HostApp, Issue25074 page, 40 iterations per run. Each run samples the caption labels of B1–B4 and B9 at 50 ms after the change: 5 buttons × 40 iterations = 200 samples. | Run | Product code | Faded captions (alpha 0) | | --- | --- | --- | | Baseline | unchanged | **200/200** | | Fix | `PerformWithoutAnimation` | **0/200** | | Fix reverted | unchanged | **200/200** | | Fix restored | `PerformWithoutAnimation` | **0/200** | iOS device tests on the iOS 26.0 simulator, using `xharness apple test` with `TestFilter=Category=Button`: | Run | Result | | --- | --- | | With the fix | 23/23 passed, including `TextChangeKeepsTitleLabelVisible` | | Fix reverted (test kept) | 22/23 passed; `TextChangeKeepsTitleLabelVisible` fails with `Expected: 1, Actual: 0` (alpha) | | Fix restored | 23/23 passed | The existing `TextUpdatesAttributedTitleWhenCharacterSpacingApplied` test (#40189) passes in all three runs. `dotnet format whitespace --folder --verify-no-changes` on both changed files reports no changes. **Limitations** - Local validation used Xcode 27.2; the repo pins Xcode 27.0. - The fix removes the alpha-0 state that matches the CI screenshots in every sample. Why the fade's completion does not run in CI is not proven. - This PR does not claim any other Mac visual failure is fixed. The UI test will be confirmed by this PR's own CI. ### Issues Fixed Fixes the `Issue25074.ButtonResizesWhenTitleOrImageChanges` Mac Catalyst failure observed on #40116. No separate issue was filed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…stay clipped (#40353) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This is a candidate-acceptance fix for SR2 candidate PR #40116, so it targets `candidate/11.0.1xx-sr2` like the other candidate fixes (#40346, #40348, #40349, #40350). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change **Failure:** on the candidate, the Windows device test `BorderTests.BorderClipsTransformedContentToItsShape(scale: 3, rotation: 0, translationX: 0, translationY: 0, hasShadow: true)` fails in both packaged and unpackaged runs with `(50,50) was (0,0,0,0)` (expected red). The rows without a shadow pass. #40349 did not change this result. **Cause:** - `WrapperView` hosts a view's `DropShadow` in a `Rectangle` (`_shadowHost`) whose only job is to carry the composition `SpriteVisual`. That Rectangle had `Fill = Transparent`. - A filled shape (even a transparent one) has XAML content bounds. `RenderTargetBitmap` sizes its capture from the element's inner bounds (its own content bounds plus the transformed bounds of its children) and ignores composition clips. - In this test the shadowed BoxView has `Scale = 3` inside a 100×100 ellipse-clipped Border. The 84×84 shadow host under the same transform contributes 252×252 bounds at offset (76,76). The capture becomes 252×252 instead of 100×100, so pixel (50,50) falls in the transparent area outside the Border. The same view without a shadow contributes no extra bounds and captures at 100×100. - **Why it surfaced now:** `UpdateShadowAsync` awaits the alpha mask before `UpdateShadowSize`. Before #40175 the mask came from an async `RenderTargetBitmap`, so the host was still 0×0 when the test captured. Since #40175 (and #40349) the shape mask is produced synchronously, so the host is already sized when the capture runs. - The Transparent fill dates back to #570 and has no stated purpose. **Fix:** create the shadow host without a `Fill`. - A WinUI shape with no Fill and no Stroke has empty content bounds (`CShape::GenerateContentBounds`), so it no longer enlarges captures. - Its hand-in composition visual (the shadow) still renders, because WinUI does not cull elements by XAML bounds. - The host also stops being hit-testable. Hit testing now matches the same view without a shadow. Previously, the transparent host could take input for an `InputTransparent` layout with a shadow, because Windows doesn't apply `InputTransparent` to the wrapper for layouts. No tests, baselines, tolerances or waits are changed. **Validation:** - Compile check (macOS, Windows TFM): `src/Core/src/Core.csproj` with `-p:TargetFrameworks=net11.0-windows10.0.19041.0` produces exactly the same errors as the unchanged base: 40, all in XAML code-behind files, because XAML compilation is disabled on macOS. None are in `WrapperView.cs`. - Windows runtime validation runs on this PR's device-test (`maui-pr-devicetests`) and UI-test (`maui-pr-uitests`) CI. The PR stays a draft until: - the Border shadow row passes; - the other Border rows stay green; - the Windows shadow and BoxView UI tests (for example `ShadowFeatureTests` and `BoxViewFeatureTests`) stay green. ### Issues Fixed Fixes the Windows `BorderClipsTransformedContentToItsShape` shadow-row failure on the SR2 candidate (#40116). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This targets `candidate/11.0.1xx-sr2`, the branch explicitly designated for fixes to failures found on the SR2 candidate PR #40116. A maintainer decides any retargeting and the merge. ### Description of Change **Symptom.** `Issue25074.ButtonResizesWhenTitleOrImageChanges` fails on Mac Catalyst in candidate UI runs and also on `net11`: - candidate UI 1685512, run 47045068, result 100228: `Altered.png` differs by 1.14% on both the first attempt and the retry. - net11 UI 1685487, run 47044278, result 100223. - The captured screenshots show buttons with **no caption**: the caption pixels are just the button background. **Root cause.** The handler creates a `UIButtonType.System` button. When `SetTitle` changes the title, UIKit cross-fades it: - the `TitleLabel` alpha is set to `0` immediately and an `opacity` animation is added; - only that animation's completion sets the alpha back to `1`. So if the completion does not run, the caption stays invisible. **Fix.** Controls `ButtonExtensions.UpdateText` (iOS/Mac Catalyst) now applies `SetTitle` and the existing `TitleLabel.Text` assignment inside `UIView.PerformWithoutAnimation`, so the label is never faded out. `StepperExtensions` already uses the same pattern. `UpdateCharacterSpacing`/`SetAttributedTitle` still runs afterwards, unchanged, and the tracing showed it does not fade. **Not changed.** Core `src/Core/src/Platform/iOS/ButtonExtensions.cs` `UpdateText` is left as is. It is only used by non-Controls `IButton` implementations, because Controls `Button` maps Text through the Controls extension. **Test.** New iOS/Mac Catalyst device test `ButtonTests.TextChangeKeepsTitleLabelVisible`. It adds a Button to a window, changes its `Text`, then asserts that `TitleLabel.Alpha == 1` and that the label has no `opacity` animation. All existing assertions and oracles are unchanged; no screenshot baselines, tolerances or masks were touched. ### Validation Mac Catalyst HostApp, Issue25074 page, 40 iterations per run. Each run samples the caption labels of B1–B4 and B9 at 50 ms after the change: 5 buttons × 40 iterations = 200 samples. | Run | Product code | Faded captions (alpha 0) | | --- | --- | --- | | Baseline | unchanged | **200/200** | | Fix | `PerformWithoutAnimation` | **0/200** | | Fix reverted | unchanged | **200/200** | | Fix restored | `PerformWithoutAnimation` | **0/200** | iOS device tests on the iOS 26.0 simulator, using `xharness apple test` with `TestFilter=Category=Button`: | Run | Result | | --- | --- | | With the fix | 23/23 passed, including `TextChangeKeepsTitleLabelVisible` | | Fix reverted (test kept) | 22/23 passed; `TextChangeKeepsTitleLabelVisible` fails with `Expected: 1, Actual: 0` (alpha) | | Fix restored | 23/23 passed | The existing `TextUpdatesAttributedTitleWhenCharacterSpacingApplied` test (#40189) passes in all three runs. `dotnet format whitespace --folder --verify-no-changes` on both changed files reports no changes. **Limitations** - Local validation used Xcode 27.2; the repo pins Xcode 27.0. - The fix removes the alpha-0 state that matches the CI screenshots in every sample. Why the fade's completion does not run in CI is not proven. - This PR does not claim any other Mac visual failure is fixed. The UI test will be confirmed by this PR's own CI. ### Issues Fixed Fixes the `Issue25074.ButtonResizesWhenTitleOrImageChanges` Mac Catalyst failure observed on #40116. No separate issue was filed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…stay clipped (#40353) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This is a candidate-acceptance fix for SR2 candidate PR #40116, so it targets `candidate/11.0.1xx-sr2` like the other candidate fixes (#40346, #40348, #40349, #40350). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change **Failure:** on the candidate, the Windows device test `BorderTests.BorderClipsTransformedContentToItsShape(scale: 3, rotation: 0, translationX: 0, translationY: 0, hasShadow: true)` fails in both packaged and unpackaged runs with `(50,50) was (0,0,0,0)` (expected red). The rows without a shadow pass. #40349 did not change this result. **Cause:** - `WrapperView` hosts a view's `DropShadow` in a `Rectangle` (`_shadowHost`) whose only job is to carry the composition `SpriteVisual`. That Rectangle had `Fill = Transparent`. - A filled shape (even a transparent one) has XAML content bounds. `RenderTargetBitmap` sizes its capture from the element's inner bounds (its own content bounds plus the transformed bounds of its children) and ignores composition clips. - In this test the shadowed BoxView has `Scale = 3` inside a 100×100 ellipse-clipped Border. The 84×84 shadow host under the same transform contributes 252×252 bounds at offset (76,76). The capture becomes 252×252 instead of 100×100, so pixel (50,50) falls in the transparent area outside the Border. The same view without a shadow contributes no extra bounds and captures at 100×100. - **Why it surfaced now:** `UpdateShadowAsync` awaits the alpha mask before `UpdateShadowSize`. Before #40175 the mask came from an async `RenderTargetBitmap`, so the host was still 0×0 when the test captured. Since #40175 (and #40349) the shape mask is produced synchronously, so the host is already sized when the capture runs. - The Transparent fill dates back to #570 and has no stated purpose. **Fix:** create the shadow host without a `Fill`. - A WinUI shape with no Fill and no Stroke has empty content bounds (`CShape::GenerateContentBounds`), so it no longer enlarges captures. - Its hand-in composition visual (the shadow) still renders, because WinUI does not cull elements by XAML bounds. - The host also stops being hit-testable. Hit testing now matches the same view without a shadow. Previously, the transparent host could take input for an `InputTransparent` layout with a shadow, because Windows doesn't apply `InputTransparent` to the wrapper for layouts. No tests, baselines, tolerances or waits are changed. **Validation:** - Compile check (macOS, Windows TFM): `src/Core/src/Core.csproj` with `-p:TargetFrameworks=net11.0-windows10.0.19041.0` produces exactly the same errors as the unchanged base: 40, all in XAML code-behind files, because XAML compilation is disabled on macOS. None are in `WrapperView.cs`. - Windows runtime validation runs on this PR's device-test (`maui-pr-devicetests`) and UI-test (`maui-pr-uitests`) CI. The PR stays a draft until: - the Border shadow row passes; - the other Border rows stay green; - the Windows shadow and BoxView UI tests (for example `ShadowFeatureTests` and `BoxViewFeatureTests`) stay green. ### Issues Fixed Fixes the Windows `BorderClipsTransformedContentToItsShape` shadow-row failure on the SR2 candidate (#40116). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This targets `candidate/11.0.1xx-sr2`, the branch explicitly designated for fixes to failures found on the SR2 candidate PR #40116. A maintainer decides any retargeting and the merge. ### Description of Change **Symptom.** `Issue25074.ButtonResizesWhenTitleOrImageChanges` fails on Mac Catalyst in candidate UI runs and also on `net11`: - candidate UI 1685512, run 47045068, result 100228: `Altered.png` differs by 1.14% on both the first attempt and the retry. - net11 UI 1685487, run 47044278, result 100223. - The captured screenshots show buttons with **no caption**: the caption pixels are just the button background. **Root cause.** The handler creates a `UIButtonType.System` button. When `SetTitle` changes the title, UIKit cross-fades it: - the `TitleLabel` alpha is set to `0` immediately and an `opacity` animation is added; - only that animation's completion sets the alpha back to `1`. So if the completion does not run, the caption stays invisible. **Fix.** Controls `ButtonExtensions.UpdateText` (iOS/Mac Catalyst) now applies `SetTitle` and the existing `TitleLabel.Text` assignment inside `UIView.PerformWithoutAnimation`, so the label is never faded out. `StepperExtensions` already uses the same pattern. `UpdateCharacterSpacing`/`SetAttributedTitle` still runs afterwards, unchanged, and the tracing showed it does not fade. **Not changed.** Core `src/Core/src/Platform/iOS/ButtonExtensions.cs` `UpdateText` is left as is. It is only used by non-Controls `IButton` implementations, because Controls `Button` maps Text through the Controls extension. **Test.** New iOS/Mac Catalyst device test `ButtonTests.TextChangeKeepsTitleLabelVisible`. It adds a Button to a window, changes its `Text`, then asserts that `TitleLabel.Alpha == 1` and that the label has no `opacity` animation. All existing assertions and oracles are unchanged; no screenshot baselines, tolerances or masks were touched. ### Validation Mac Catalyst HostApp, Issue25074 page, 40 iterations per run. Each run samples the caption labels of B1–B4 and B9 at 50 ms after the change: 5 buttons × 40 iterations = 200 samples. | Run | Product code | Faded captions (alpha 0) | | --- | --- | --- | | Baseline | unchanged | **200/200** | | Fix | `PerformWithoutAnimation` | **0/200** | | Fix reverted | unchanged | **200/200** | | Fix restored | `PerformWithoutAnimation` | **0/200** | iOS device tests on the iOS 26.0 simulator, using `xharness apple test` with `TestFilter=Category=Button`: | Run | Result | | --- | --- | | With the fix | 23/23 passed, including `TextChangeKeepsTitleLabelVisible` | | Fix reverted (test kept) | 22/23 passed; `TextChangeKeepsTitleLabelVisible` fails with `Expected: 1, Actual: 0` (alpha) | | Fix restored | 23/23 passed | The existing `TextUpdatesAttributedTitleWhenCharacterSpacingApplied` test (#40189) passes in all three runs. `dotnet format whitespace --folder --verify-no-changes` on both changed files reports no changes. **Limitations** - Local validation used Xcode 27.2; the repo pins Xcode 27.0. - The fix removes the alpha-0 state that matches the CI screenshots in every sample. Why the fade's completion does not run in CI is not proven. - This PR does not claim any other Mac visual failure is fixed. The UI test will be confirmed by this PR's own CI. ### Issues Fixed Fixes the `Issue25074.ButtonResizesWhenTitleOrImageChanges` Mac Catalyst failure observed on #40116. No separate issue was filed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…stay clipped (#40353) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This is a candidate-acceptance fix for SR2 candidate PR #40116, so it targets `candidate/11.0.1xx-sr2` like the other candidate fixes (#40346, #40348, #40349, #40350). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change **Failure:** on the candidate, the Windows device test `BorderTests.BorderClipsTransformedContentToItsShape(scale: 3, rotation: 0, translationX: 0, translationY: 0, hasShadow: true)` fails in both packaged and unpackaged runs with `(50,50) was (0,0,0,0)` (expected red). The rows without a shadow pass. #40349 did not change this result. **Cause:** - `WrapperView` hosts a view's `DropShadow` in a `Rectangle` (`_shadowHost`) whose only job is to carry the composition `SpriteVisual`. That Rectangle had `Fill = Transparent`. - A filled shape (even a transparent one) has XAML content bounds. `RenderTargetBitmap` sizes its capture from the element's inner bounds (its own content bounds plus the transformed bounds of its children) and ignores composition clips. - In this test the shadowed BoxView has `Scale = 3` inside a 100×100 ellipse-clipped Border. The 84×84 shadow host under the same transform contributes 252×252 bounds at offset (76,76). The capture becomes 252×252 instead of 100×100, so pixel (50,50) falls in the transparent area outside the Border. The same view without a shadow contributes no extra bounds and captures at 100×100. - **Why it surfaced now:** `UpdateShadowAsync` awaits the alpha mask before `UpdateShadowSize`. Before #40175 the mask came from an async `RenderTargetBitmap`, so the host was still 0×0 when the test captured. Since #40175 (and #40349) the shape mask is produced synchronously, so the host is already sized when the capture runs. - The Transparent fill dates back to #570 and has no stated purpose. **Fix:** create the shadow host without a `Fill`. - A WinUI shape with no Fill and no Stroke has empty content bounds (`CShape::GenerateContentBounds`), so it no longer enlarges captures. - Its hand-in composition visual (the shadow) still renders, because WinUI does not cull elements by XAML bounds. - The host also stops being hit-testable. Hit testing now matches the same view without a shadow. Previously, the transparent host could take input for an `InputTransparent` layout with a shadow, because Windows doesn't apply `InputTransparent` to the wrapper for layouts. No tests, baselines, tolerances or waits are changed. **Validation:** - Compile check (macOS, Windows TFM): `src/Core/src/Core.csproj` with `-p:TargetFrameworks=net11.0-windows10.0.19041.0` produces exactly the same errors as the unchanged base: 40, all in XAML code-behind files, because XAML compilation is disabled on macOS. None are in `WrapperView.cs`. - Windows runtime validation runs on this PR's device-test (`maui-pr-devicetests`) and UI-test (`maui-pr-uitests`) CI. The PR stays a draft until: - the Border shadow row passes; - the other Border rows stay green; - the Windows shadow and BoxView UI tests (for example `ShadowFeatureTests` and `BoxViewFeatureTests`) stay green. ### Issues Fixed Fixes the Windows `BorderClipsTransformedContentToItsShape` shadow-row failure on the SR2 candidate (#40116). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This targets `candidate/11.0.1xx-sr2`, the branch explicitly designated for fixes to failures found on the SR2 candidate PR #40116. A maintainer decides any retargeting and the merge. ### Description of Change **Symptom.** `Issue25074.ButtonResizesWhenTitleOrImageChanges` fails on Mac Catalyst in candidate UI runs and also on `net11`: - candidate UI 1685512, run 47045068, result 100228: `Altered.png` differs by 1.14% on both the first attempt and the retry. - net11 UI 1685487, run 47044278, result 100223. - The captured screenshots show buttons with **no caption**: the caption pixels are just the button background. **Root cause.** The handler creates a `UIButtonType.System` button. When `SetTitle` changes the title, UIKit cross-fades it: - the `TitleLabel` alpha is set to `0` immediately and an `opacity` animation is added; - only that animation's completion sets the alpha back to `1`. So if the completion does not run, the caption stays invisible. **Fix.** Controls `ButtonExtensions.UpdateText` (iOS/Mac Catalyst) now applies `SetTitle` and the existing `TitleLabel.Text` assignment inside `UIView.PerformWithoutAnimation`, so the label is never faded out. `StepperExtensions` already uses the same pattern. `UpdateCharacterSpacing`/`SetAttributedTitle` still runs afterwards, unchanged, and the tracing showed it does not fade. **Not changed.** Core `src/Core/src/Platform/iOS/ButtonExtensions.cs` `UpdateText` is left as is. It is only used by non-Controls `IButton` implementations, because Controls `Button` maps Text through the Controls extension. **Test.** New iOS/Mac Catalyst device test `ButtonTests.TextChangeKeepsTitleLabelVisible`. It adds a Button to a window, changes its `Text`, then asserts that `TitleLabel.Alpha == 1` and that the label has no `opacity` animation. All existing assertions and oracles are unchanged; no screenshot baselines, tolerances or masks were touched. ### Validation Mac Catalyst HostApp, Issue25074 page, 40 iterations per run. Each run samples the caption labels of B1–B4 and B9 at 50 ms after the change: 5 buttons × 40 iterations = 200 samples. | Run | Product code | Faded captions (alpha 0) | | --- | --- | --- | | Baseline | unchanged | **200/200** | | Fix | `PerformWithoutAnimation` | **0/200** | | Fix reverted | unchanged | **200/200** | | Fix restored | `PerformWithoutAnimation` | **0/200** | iOS device tests on the iOS 26.0 simulator, using `xharness apple test` with `TestFilter=Category=Button`: | Run | Result | | --- | --- | | With the fix | 23/23 passed, including `TextChangeKeepsTitleLabelVisible` | | Fix reverted (test kept) | 22/23 passed; `TextChangeKeepsTitleLabelVisible` fails with `Expected: 1, Actual: 0` (alpha) | | Fix restored | 23/23 passed | The existing `TextUpdatesAttributedTitleWhenCharacterSpacingApplied` test (#40189) passes in all three runs. `dotnet format whitespace --folder --verify-no-changes` on both changed files reports no changes. **Limitations** - Local validation used Xcode 27.2; the repo pins Xcode 27.0. - The fix removes the alpha-0 state that matches the CI screenshots in every sample. Why the fade's completion does not run in CI is not proven. - This PR does not claim any other Mac visual failure is fixed. The UI test will be confirmed by this PR's own CI. ### Issues Fixed Fixes the `Issue25074.ButtonResizesWhenTitleOrImageChanges` Mac Catalyst failure observed on #40116. No separate issue was filed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…stay clipped (#40353) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This is a candidate-acceptance fix for SR2 candidate PR #40116, so it targets `candidate/11.0.1xx-sr2` like the other candidate fixes (#40346, #40348, #40349, #40350). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change **Failure:** on the candidate, the Windows device test `BorderTests.BorderClipsTransformedContentToItsShape(scale: 3, rotation: 0, translationX: 0, translationY: 0, hasShadow: true)` fails in both packaged and unpackaged runs with `(50,50) was (0,0,0,0)` (expected red). The rows without a shadow pass. #40349 did not change this result. **Cause:** - `WrapperView` hosts a view's `DropShadow` in a `Rectangle` (`_shadowHost`) whose only job is to carry the composition `SpriteVisual`. That Rectangle had `Fill = Transparent`. - A filled shape (even a transparent one) has XAML content bounds. `RenderTargetBitmap` sizes its capture from the element's inner bounds (its own content bounds plus the transformed bounds of its children) and ignores composition clips. - In this test the shadowed BoxView has `Scale = 3` inside a 100×100 ellipse-clipped Border. The 84×84 shadow host under the same transform contributes 252×252 bounds at offset (76,76). The capture becomes 252×252 instead of 100×100, so pixel (50,50) falls in the transparent area outside the Border. The same view without a shadow contributes no extra bounds and captures at 100×100. - **Why it surfaced now:** `UpdateShadowAsync` awaits the alpha mask before `UpdateShadowSize`. Before #40175 the mask came from an async `RenderTargetBitmap`, so the host was still 0×0 when the test captured. Since #40175 (and #40349) the shape mask is produced synchronously, so the host is already sized when the capture runs. - The Transparent fill dates back to #570 and has no stated purpose. **Fix:** create the shadow host without a `Fill`. - A WinUI shape with no Fill and no Stroke has empty content bounds (`CShape::GenerateContentBounds`), so it no longer enlarges captures. - Its hand-in composition visual (the shadow) still renders, because WinUI does not cull elements by XAML bounds. - The host also stops being hit-testable. Hit testing now matches the same view without a shadow. Previously, the transparent host could take input for an `InputTransparent` layout with a shadow, because Windows doesn't apply `InputTransparent` to the wrapper for layouts. No tests, baselines, tolerances or waits are changed. **Validation:** - Compile check (macOS, Windows TFM): `src/Core/src/Core.csproj` with `-p:TargetFrameworks=net11.0-windows10.0.19041.0` produces exactly the same errors as the unchanged base: 40, all in XAML code-behind files, because XAML compilation is disabled on macOS. None are in `WrapperView.cs`. - Windows runtime validation runs on this PR's device-test (`maui-pr-devicetests`) and UI-test (`maui-pr-uitests`) CI. The PR stays a draft until: - the Border shadow row passes; - the other Border rows stay green; - the Windows shadow and BoxView UI tests (for example `ShadowFeatureTests` and `BoxViewFeatureTests`) stay green. ### Issues Fixed Fixes the Windows `BorderClipsTransformedContentToItsShape` shadow-row failure on the SR2 candidate (#40116). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…0348) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This targets `candidate/11.0.1xx-sr2`, the branch explicitly designated for fixes to failures found on the SR2 candidate PR dotnet#40116. A maintainer decides any retargeting and the merge. ### Description of Change **Symptom.** `Issue25074.ButtonResizesWhenTitleOrImageChanges` fails on Mac Catalyst in candidate UI runs and also on `net11`: - candidate UI 1685512, run 47045068, result 100228: `Altered.png` differs by 1.14% on both the first attempt and the retry. - net11 UI 1685487, run 47044278, result 100223. - The captured screenshots show buttons with **no caption**: the caption pixels are just the button background. **Root cause.** The handler creates a `UIButtonType.System` button. When `SetTitle` changes the title, UIKit cross-fades it: - the `TitleLabel` alpha is set to `0` immediately and an `opacity` animation is added; - only that animation's completion sets the alpha back to `1`. So if the completion does not run, the caption stays invisible. **Fix.** Controls `ButtonExtensions.UpdateText` (iOS/Mac Catalyst) now applies `SetTitle` and the existing `TitleLabel.Text` assignment inside `UIView.PerformWithoutAnimation`, so the label is never faded out. `StepperExtensions` already uses the same pattern. `UpdateCharacterSpacing`/`SetAttributedTitle` still runs afterwards, unchanged, and the tracing showed it does not fade. **Not changed.** Core `src/Core/src/Platform/iOS/ButtonExtensions.cs` `UpdateText` is left as is. It is only used by non-Controls `IButton` implementations, because Controls `Button` maps Text through the Controls extension. **Test.** New iOS/Mac Catalyst device test `ButtonTests.TextChangeKeepsTitleLabelVisible`. It adds a Button to a window, changes its `Text`, then asserts that `TitleLabel.Alpha == 1` and that the label has no `opacity` animation. All existing assertions and oracles are unchanged; no screenshot baselines, tolerances or masks were touched. ### Validation Mac Catalyst HostApp, Issue25074 page, 40 iterations per run. Each run samples the caption labels of B1–B4 and B9 at 50 ms after the change: 5 buttons × 40 iterations = 200 samples. | Run | Product code | Faded captions (alpha 0) | | --- | --- | --- | | Baseline | unchanged | **200/200** | | Fix | `PerformWithoutAnimation` | **0/200** | | Fix reverted | unchanged | **200/200** | | Fix restored | `PerformWithoutAnimation` | **0/200** | iOS device tests on the iOS 26.0 simulator, using `xharness apple test` with `TestFilter=Category=Button`: | Run | Result | | --- | --- | | With the fix | 23/23 passed, including `TextChangeKeepsTitleLabelVisible` | | Fix reverted (test kept) | 22/23 passed; `TextChangeKeepsTitleLabelVisible` fails with `Expected: 1, Actual: 0` (alpha) | | Fix restored | 23/23 passed | The existing `TextUpdatesAttributedTitleWhenCharacterSpacingApplied` test (dotnet#40189) passes in all three runs. `dotnet format whitespace --folder --verify-no-changes` on both changed files reports no changes. **Limitations** - Local validation used Xcode 27.2; the repo pins Xcode 27.0. - The fix removes the alpha-0 state that matches the CI screenshots in every sample. Why the fade's completion does not run in CI is not proven. - This PR does not claim any other Mac visual failure is fixed. The UI test will be confirmed by this PR's own CI. ### Issues Fixed Fixes the `Issue25074.ButtonResizesWhenTitleOrImageChanges` Mac Catalyst failure observed on dotnet#40116. No separate issue was filed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…stay clipped (dotnet#40353) <!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). This is a candidate-acceptance fix for SR2 candidate PR dotnet#40116, so it targets `candidate/11.0.1xx-sr2` like the other candidate fixes (dotnet#40346, dotnet#40348, dotnet#40349, dotnet#40350). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Description of Change **Failure:** on the candidate, the Windows device test `BorderTests.BorderClipsTransformedContentToItsShape(scale: 3, rotation: 0, translationX: 0, translationY: 0, hasShadow: true)` fails in both packaged and unpackaged runs with `(50,50) was (0,0,0,0)` (expected red). The rows without a shadow pass. dotnet#40349 did not change this result. **Cause:** - `WrapperView` hosts a view's `DropShadow` in a `Rectangle` (`_shadowHost`) whose only job is to carry the composition `SpriteVisual`. That Rectangle had `Fill = Transparent`. - A filled shape (even a transparent one) has XAML content bounds. `RenderTargetBitmap` sizes its capture from the element's inner bounds (its own content bounds plus the transformed bounds of its children) and ignores composition clips. - In this test the shadowed BoxView has `Scale = 3` inside a 100×100 ellipse-clipped Border. The 84×84 shadow host under the same transform contributes 252×252 bounds at offset (76,76). The capture becomes 252×252 instead of 100×100, so pixel (50,50) falls in the transparent area outside the Border. The same view without a shadow contributes no extra bounds and captures at 100×100. - **Why it surfaced now:** `UpdateShadowAsync` awaits the alpha mask before `UpdateShadowSize`. Before dotnet#40175 the mask came from an async `RenderTargetBitmap`, so the host was still 0×0 when the test captured. Since dotnet#40175 (and dotnet#40349) the shape mask is produced synchronously, so the host is already sized when the capture runs. - The Transparent fill dates back to dotnet#570 and has no stated purpose. **Fix:** create the shadow host without a `Fill`. - A WinUI shape with no Fill and no Stroke has empty content bounds (`CShape::GenerateContentBounds`), so it no longer enlarges captures. - Its hand-in composition visual (the shadow) still renders, because WinUI does not cull elements by XAML bounds. - The host also stops being hit-testable. Hit testing now matches the same view without a shadow. Previously, the transparent host could take input for an `InputTransparent` layout with a shadow, because Windows doesn't apply `InputTransparent` to the wrapper for layouts. No tests, baselines, tolerances or waits are changed. **Validation:** - Compile check (macOS, Windows TFM): `src/Core/src/Core.csproj` with `-p:TargetFrameworks=net11.0-windows10.0.19041.0` produces exactly the same errors as the unchanged base: 40, all in XAML code-behind files, because XAML compilation is disabled on macOS. None are in `WrapperView.cs`. - Windows runtime validation runs on this PR's device-test (`maui-pr-devicetests`) and UI-test (`maui-pr-uitests`) CI. The PR stays a draft until: - the Border shadow row passes; - the other Border rows stay green; - the Windows shadow and BoxView UI tests (for example `ShadowFeatureTests` and `BoxViewFeatureTests`) stay green. ### Issues Fixed Fixes the Windows `BorderClipsTransformedContentToItsShape` shadow-row failure on the SR2 candidate (dotnet#40116). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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!
Target Branch
mainnet11, for reviewThis targets
candidate/11.0.1xx-sr2, the branch explicitly designated for fixes to failures found on the SR2 candidate PR #40116. A maintainer decides any retargeting and the merge.Description of Change
Symptom.
Issue25074.ButtonResizesWhenTitleOrImageChangesfails on Mac Catalyst in candidate UI runs and also onnet11:Altered.pngdiffers by 1.14% on both the first attempt and the retry.Root cause. The handler creates a
UIButtonType.Systembutton. WhenSetTitlechanges the title, UIKit cross-fades it:TitleLabelalpha is set to0immediately and anopacityanimation is added;1.So if the completion does not run, the caption stays invisible.
Fix. Controls
ButtonExtensions.UpdateText(iOS/Mac Catalyst) now appliesSetTitleand the existingTitleLabel.Textassignment insideUIView.PerformWithoutAnimation, so the label is never faded out.StepperExtensionsalready uses the same pattern.UpdateCharacterSpacing/SetAttributedTitlestill runs afterwards, unchanged, and the tracing showed it does not fade.Not changed. Core
src/Core/src/Platform/iOS/ButtonExtensions.csUpdateTextis left as is. It is only used by non-ControlsIButtonimplementations, because ControlsButtonmaps Text through the Controls extension.Test. New iOS/Mac Catalyst device test
ButtonTests.TextChangeKeepsTitleLabelVisible. It adds a Button to a window, changes itsText, then asserts thatTitleLabel.Alpha == 1and that the label has noopacityanimation. All existing assertions and oracles are unchanged; no screenshot baselines, tolerances or masks were touched.Validation
Mac Catalyst HostApp, Issue25074 page, 40 iterations per run. Each run samples the caption labels of B1–B4 and B9 at 50 ms after the change: 5 buttons × 40 iterations = 200 samples.
PerformWithoutAnimationPerformWithoutAnimationiOS device tests on the iOS 26.0 simulator, using
xharness apple testwithTestFilter=Category=Button:TextChangeKeepsTitleLabelVisibleTextChangeKeepsTitleLabelVisiblefails withExpected: 1, Actual: 0(alpha)The existing
TextUpdatesAttributedTitleWhenCharacterSpacingAppliedtest (#40189) passes in all three runs.dotnet format whitespace --folder --verify-no-changeson both changed files reports no changes.Limitations
Issues Fixed
Fixes the
Issue25074.ButtonResizesWhenTitleOrImageChangesMac Catalyst failure observed on #40116. No separate issue was filed.