Skip to content

[WIP] [iOS] Fix Shell tab switching grey flash on iOS - #39893

Closed
Dhivya-SF4094 wants to merge 4 commits into
dotnet:mainfrom
Dhivya-SF4094:fix-39800
Closed

Dhivya-SF4094 wants to merge 4 commits into
dotnet:mainfrom
Dhivya-SF4094:fix-39800

Conversation

@Dhivya-SF4094

@Dhivya-SF4094 Dhivya-SF4094 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

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!

Issue Detail:

Switching between Shell’s bottom tabs briefly turns the page background grey, even though every page and its content have a black background. The bottom tab bar remains black. The flash happens during the transition, not after the new page has finished appearing.

Root cause:

On iOS 18+, UIKit applies a fade when UITabBarController.SelectedViewController changes.
During the fade, the page views temporarily become partially transparent, exposing the white tab-controller background underneath. White showing through black produces the visible grey flash.

Description of Change

On iOS 18+ and Mac Catalyst 18+, synchronize the tab controller’s backing-view background with the displayed page’s background using UpdateBackground . This prevents a mismatched backing color from showing during native tab cross-fades, while preserving the native animation.

The method restores the captured native/custom background when its previous override is still present; otherwise, it captures the current background to preserve external customizations. then applies the page background unless the page has reduced opacity or its background is empty or recognized as transparent. It runs when the displayed page changes and when its background or opacity changes.

The fix covers both  ShellItemRenderer  and  ShellItemHandler

Validated the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed:

Fixes #39800

Screenshots

Before After
39800_Beforefix.mov
39800_Afterfix.mov

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39893

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39893"

@azure-pipelines

This comment has been minimized.

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Nov 4, 2026
@NirmalKumarYuvaraj NirmalKumarYuvaraj added the do-not-merge Don't merge this PR label Nov 4, 2026
@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Nov 4, 2026
@azure-pipelines

This comment has been minimized.

@vishnumenon2684

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@MauiBot

This comment has been minimized.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Nov 4, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — 2 findings

Reviewed commit d1c694b.

See inline comments for details.

@vishnumenon2684

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Nov 6, 2026
@MauiBot

MauiBot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

PR Test Gate

@Dhivya-SF4094 — existing-test verification for commit a26a4300.

Result SKIPPED Platform Android Commit a26a4300


🧪 Gate analysis — click to expand

⚠ Skipped. No runnable PR tests were selected. The fix has not been verified by this gate.

No interpretable test-group summary was produced. No additional test execution is inferred.

PR head: a26a4300.

Without-fix baseline: e6abee71.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Nov 6, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expert Review — 2 findings

Reviewed commit a26a430.

See inline comments for details.

}

// UIKit's tab cross-fade exposes this backing view between the two pages.
view.UpdateBackground(background);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[moderate] Backward Compatibility and Migration - On iOS/MacCatalyst 18+, a custom ShellItemRenderer that applies a backing gradient with View.UpdateBackground(gradientPaint) loses it on the next switch to a transparent page. This page is excluded from mirroring, but UpdateBackground(null) still calls RemoveBackgroundLayer() before returning, deleting the custom layer even when OverrideApplied is false. ContentBackgroundState retains only UIColor, so an opaque-page round trip cannot restore that gradient either. Preserve externally supplied background layers and remove only layers owned by this workaround; the new custom-background test covers only solid colors.

@@ -0,0 +1,295 @@
#if IOS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[moderate] Regression Prevention and Test Coverage - #if IOS excludes every new regression test from Mac Catalyst, although both production implementations apply the new backing-background override on Mac Catalyst 18+. Consequently, native-color preservation and displayed-page background/opacity round trips have no coverage on that affected platform. Controls.DeviceTests already includes .iOS.cs files for Catalyst; enable those non-tab-button cases for Catalyst and adjust their iOS-only runtime guards. The documented iOS 26 tab-button limitation does not prevent these direct backing-view assertions.

@kubaflo

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Tests Failure Analysis

@Dhivya-SF4094 — test-failure analysis for commit a26a430.

Scope CI failures Commit a26a430


🧪 CI Analysis — click to expand
📊 maui-pr

No failures found.


🧪 maui-pr-devicetests

No failures found.


🧪 maui-pr-uitests

🧭 Follow-up — actions and refresh

Next action: Restore complete UI diagnostics and compare unresolved Mac failures on equivalent target configurations.

Maintainers: comment /review tests to refresh this report.

kubaflo added a commit that referenced this pull request Nov 14, 2026
…40221)

### Description of Change

On iOS 18.x, switching Shell tabs flashes grey for a few frames even
when every page and Shell color is black.

`ShellItemRenderer` never sets its `UITabBarController` view's
background, so that view keeps UIKit's default, white in light mode. On
iOS 18 the tab controller cross-fades tab switches, and a probe built
into a two-tab black app caught UIKit fading a full-screen white
backdrop between the outgoing and incoming pages (opacity 0 → 0.89 over
4–5 frames). Black pages composited over white read as grey. Recoloring
that one view red turned the flash red; coloring it black made the flash
vanish while the native cross-fade kept running (401 animations over 10
switches, zero grey frames). iOS 26 doesn't cross-fade at all, which is
why the report is 18.x-specific.

The fix mirrors the displayed page's solid opaque background onto the
tab controller's view (and onto `PlatformView` in the handler path) on
iOS and Mac Catalyst 18+. It captures the previous color the first time
it overrides and restores it when the page background goes away.
Translucent colors, gradients and pages with `Opacity < 1` are left
alone.

The earlier WIP attempt (#39893) was flagged for capturing state at
`ViewDidLoad` before custom renderers run and for routing through
`UpdateBackground`, which can delete externally applied gradient layers.
This change avoids both by design: the capture is lazy, and only
`BackgroundColor` is ever touched.

**Tests / evidence**

`ShellTabSwitchBackgroundTests` (iOS device test, Shell category, gated
to iOS/Catalyst 18+): builds a two-tab Shell, locates the
`UITabBarController` backing view, and asserts it adopts the displayed
page's opaque black background, then restores the captured default when
the background is cleared. No pixel sampling or display links involved.
Review follow-up (3fcfbae) extends this with preconfigured
backgrounds asserted across a real tab switch (no post-attach mutation),
the `Opacity < 1` exclusion sequence, and a second theory row that
registers the handler-based Shell so the `ShellItemHandler` path runs
too.

| | Without fix | With fix |
|---|---|---|
| iOS Shell category (iOS 26.5 simulator) | 508 of 510 passed; the only
2 failures are the new test under both Shell variants | 518 passed, 0
failed (with the extended coverage) |
| Frame scan of a two-tab black app on an iOS 18.5 simulator, ~11
switches | a grey event (3–4 mid-grey frames) at every switch | zero
grey frames; the cross-fade still runs |

**Before / after** (two-tab black sandbox app, iOS 18.5 simulator; both
stills are mid-cross-fade frames, the tab labels blended):

| Before: the page area washes grey during the switch | After: it stays
black, only the label fades |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.mp4)

### Issues Fixed

Fixes #39800

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 16, 2026
…40221)

### Description of Change

On iOS 18.x, switching Shell tabs flashes grey for a few frames even
when every page and Shell color is black.

`ShellItemRenderer` never sets its `UITabBarController` view's
background, so that view keeps UIKit's default, white in light mode. On
iOS 18 the tab controller cross-fades tab switches, and a probe built
into a two-tab black app caught UIKit fading a full-screen white
backdrop between the outgoing and incoming pages (opacity 0 → 0.89 over
4–5 frames). Black pages composited over white read as grey. Recoloring
that one view red turned the flash red; coloring it black made the flash
vanish while the native cross-fade kept running (401 animations over 10
switches, zero grey frames). iOS 26 doesn't cross-fade at all, which is
why the report is 18.x-specific.

The fix mirrors the displayed page's solid opaque background onto the
tab controller's view (and onto `PlatformView` in the handler path) on
iOS and Mac Catalyst 18+. It captures the previous color the first time
it overrides and restores it when the page background goes away.
Translucent colors, gradients and pages with `Opacity < 1` are left
alone.

The earlier WIP attempt (#39893) was flagged for capturing state at
`ViewDidLoad` before custom renderers run and for routing through
`UpdateBackground`, which can delete externally applied gradient layers.
This change avoids both by design: the capture is lazy, and only
`BackgroundColor` is ever touched.

**Tests / evidence**

`ShellTabSwitchBackgroundTests` (iOS device test, Shell category, gated
to iOS/Catalyst 18+): builds a two-tab Shell, locates the
`UITabBarController` backing view, and asserts it adopts the displayed
page's opaque black background, then restores the captured default when
the background is cleared. No pixel sampling or display links involved.
Review follow-up (3fcfbae) extends this with preconfigured
backgrounds asserted across a real tab switch (no post-attach mutation),
the `Opacity < 1` exclusion sequence, and a second theory row that
registers the handler-based Shell so the `ShellItemHandler` path runs
too.

| | Without fix | With fix |
|---|---|---|
| iOS Shell category (iOS 26.5 simulator) | 508 of 510 passed; the only
2 failures are the new test under both Shell variants | 518 passed, 0
failed (with the extended coverage) |
| Frame scan of a two-tab black app on an iOS 18.5 simulator, ~11
switches | a grey event (3–4 mid-grey frames) at every switch | zero
grey frames; the cross-fade still runs |

**Before / after** (two-tab black sandbox app, iOS 18.5 simulator; both
stills are mid-cross-fade frames, the tab labels blended):

| Before: the page area washes grey during the switch | After: it stays
black, only the label fades |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.mp4)

### Issues Fixed

Fixes #39800

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 16, 2026
…40221)

### Description of Change

On iOS 18.x, switching Shell tabs flashes grey for a few frames even
when every page and Shell color is black.

`ShellItemRenderer` never sets its `UITabBarController` view's
background, so that view keeps UIKit's default, white in light mode. On
iOS 18 the tab controller cross-fades tab switches, and a probe built
into a two-tab black app caught UIKit fading a full-screen white
backdrop between the outgoing and incoming pages (opacity 0 → 0.89 over
4–5 frames). Black pages composited over white read as grey. Recoloring
that one view red turned the flash red; coloring it black made the flash
vanish while the native cross-fade kept running (401 animations over 10
switches, zero grey frames). iOS 26 doesn't cross-fade at all, which is
why the report is 18.x-specific.

The fix mirrors the displayed page's solid opaque background onto the
tab controller's view (and onto `PlatformView` in the handler path) on
iOS and Mac Catalyst 18+. It captures the previous color the first time
it overrides and restores it when the page background goes away.
Translucent colors, gradients and pages with `Opacity < 1` are left
alone.

The earlier WIP attempt (#39893) was flagged for capturing state at
`ViewDidLoad` before custom renderers run and for routing through
`UpdateBackground`, which can delete externally applied gradient layers.
This change avoids both by design: the capture is lazy, and only
`BackgroundColor` is ever touched.

**Tests / evidence**

`ShellTabSwitchBackgroundTests` (iOS device test, Shell category, gated
to iOS/Catalyst 18+): builds a two-tab Shell, locates the
`UITabBarController` backing view, and asserts it adopts the displayed
page's opaque black background, then restores the captured default when
the background is cleared. No pixel sampling or display links involved.
Review follow-up (3fcfbae) extends this with preconfigured
backgrounds asserted across a real tab switch (no post-attach mutation),
the `Opacity < 1` exclusion sequence, and a second theory row that
registers the handler-based Shell so the `ShellItemHandler` path runs
too.

| | Without fix | With fix |
|---|---|---|
| iOS Shell category (iOS 26.5 simulator) | 508 of 510 passed; the only
2 failures are the new test under both Shell variants | 518 passed, 0
failed (with the extended coverage) |
| Frame scan of a two-tab black app on an iOS 18.5 simulator, ~11
switches | a grey event (3–4 mid-grey frames) at every switch | zero
grey frames; the cross-fade still runs |

**Before / after** (two-tab black sandbox app, iOS 18.5 simulator; both
stills are mid-cross-fade frames, the tab labels blended):

| Before: the page area washes grey during the switch | After: it stays
black, only the label fades |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.mp4)

### Issues Fixed

Fixes #39800

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 17, 2026
…40221)

### Description of Change

On iOS 18.x, switching Shell tabs flashes grey for a few frames even
when every page and Shell color is black.

`ShellItemRenderer` never sets its `UITabBarController` view's
background, so that view keeps UIKit's default, white in light mode. On
iOS 18 the tab controller cross-fades tab switches, and a probe built
into a two-tab black app caught UIKit fading a full-screen white
backdrop between the outgoing and incoming pages (opacity 0 → 0.89 over
4–5 frames). Black pages composited over white read as grey. Recoloring
that one view red turned the flash red; coloring it black made the flash
vanish while the native cross-fade kept running (401 animations over 10
switches, zero grey frames). iOS 26 doesn't cross-fade at all, which is
why the report is 18.x-specific.

The fix mirrors the displayed page's solid opaque background onto the
tab controller's view (and onto `PlatformView` in the handler path) on
iOS and Mac Catalyst 18+. It captures the previous color the first time
it overrides and restores it when the page background goes away.
Translucent colors, gradients and pages with `Opacity < 1` are left
alone.

The earlier WIP attempt (#39893) was flagged for capturing state at
`ViewDidLoad` before custom renderers run and for routing through
`UpdateBackground`, which can delete externally applied gradient layers.
This change avoids both by design: the capture is lazy, and only
`BackgroundColor` is ever touched.

**Tests / evidence**

`ShellTabSwitchBackgroundTests` (iOS device test, Shell category, gated
to iOS/Catalyst 18+): builds a two-tab Shell, locates the
`UITabBarController` backing view, and asserts it adopts the displayed
page's opaque black background, then restores the captured default when
the background is cleared. No pixel sampling or display links involved.
Review follow-up (3fcfbae) extends this with preconfigured
backgrounds asserted across a real tab switch (no post-attach mutation),
the `Opacity < 1` exclusion sequence, and a second theory row that
registers the handler-based Shell so the `ShellItemHandler` path runs
too.

| | Without fix | With fix |
|---|---|---|
| iOS Shell category (iOS 26.5 simulator) | 508 of 510 passed; the only
2 failures are the new test under both Shell variants | 518 passed, 0
failed (with the extended coverage) |
| Frame scan of a two-tab black app on an iOS 18.5 simulator, ~11
switches | a grey event (3–4 mid-grey frames) at every switch | zero
grey frames; the cross-fade still runs |

**Before / after** (two-tab black sandbox app, iOS 18.5 simulator; both
stills are mid-cross-fade frames, the tab labels blended):

| Before: the page area washes grey during the switch | After: it stays
black, only the label fades |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.mp4)

### Issues Fixed

Fixes #39800

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
…40221)

### Description of Change

On iOS 18.x, switching Shell tabs flashes grey for a few frames even
when every page and Shell color is black.

`ShellItemRenderer` never sets its `UITabBarController` view's
background, so that view keeps UIKit's default, white in light mode. On
iOS 18 the tab controller cross-fades tab switches, and a probe built
into a two-tab black app caught UIKit fading a full-screen white
backdrop between the outgoing and incoming pages (opacity 0 → 0.89 over
4–5 frames). Black pages composited over white read as grey. Recoloring
that one view red turned the flash red; coloring it black made the flash
vanish while the native cross-fade kept running (401 animations over 10
switches, zero grey frames). iOS 26 doesn't cross-fade at all, which is
why the report is 18.x-specific.

The fix mirrors the displayed page's solid opaque background onto the
tab controller's view (and onto `PlatformView` in the handler path) on
iOS and Mac Catalyst 18+. It captures the previous color the first time
it overrides and restores it when the page background goes away.
Translucent colors, gradients and pages with `Opacity < 1` are left
alone.

The earlier WIP attempt (#39893) was flagged for capturing state at
`ViewDidLoad` before custom renderers run and for routing through
`UpdateBackground`, which can delete externally applied gradient layers.
This change avoids both by design: the capture is lazy, and only
`BackgroundColor` is ever touched.

**Tests / evidence**

`ShellTabSwitchBackgroundTests` (iOS device test, Shell category, gated
to iOS/Catalyst 18+): builds a two-tab Shell, locates the
`UITabBarController` backing view, and asserts it adopts the displayed
page's opaque black background, then restores the captured default when
the background is cleared. No pixel sampling or display links involved.
Review follow-up (3fcfbae) extends this with preconfigured
backgrounds asserted across a real tab switch (no post-attach mutation),
the `Opacity < 1` exclusion sequence, and a second theory row that
registers the handler-based Shell so the `ShellItemHandler` path runs
too.

| | Without fix | With fix |
|---|---|---|
| iOS Shell category (iOS 26.5 simulator) | 508 of 510 passed; the only
2 failures are the new test under both Shell variants | 518 passed, 0
failed (with the extended coverage) |
| Frame scan of a two-tab black app on an iOS 18.5 simulator, ~11
switches | a grey event (3–4 mid-grey frames) at every switch | zero
grey frames; the cross-fade still runs |

**Before / after** (two-tab black sandbox app, iOS 18.5 simulator; both
stills are mid-cross-fade frames, the tab labels blended):

| Before: the page area washes grey during the switch | After: it stays
black, only the label fades |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.mp4)

### Issues Fixed

Fixes #39800

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
…40221)

### Description of Change

On iOS 18.x, switching Shell tabs flashes grey for a few frames even
when every page and Shell color is black.

`ShellItemRenderer` never sets its `UITabBarController` view's
background, so that view keeps UIKit's default, white in light mode. On
iOS 18 the tab controller cross-fades tab switches, and a probe built
into a two-tab black app caught UIKit fading a full-screen white
backdrop between the outgoing and incoming pages (opacity 0 → 0.89 over
4–5 frames). Black pages composited over white read as grey. Recoloring
that one view red turned the flash red; coloring it black made the flash
vanish while the native cross-fade kept running (401 animations over 10
switches, zero grey frames). iOS 26 doesn't cross-fade at all, which is
why the report is 18.x-specific.

The fix mirrors the displayed page's solid opaque background onto the
tab controller's view (and onto `PlatformView` in the handler path) on
iOS and Mac Catalyst 18+. It captures the previous color the first time
it overrides and restores it when the page background goes away.
Translucent colors, gradients and pages with `Opacity < 1` are left
alone.

The earlier WIP attempt (#39893) was flagged for capturing state at
`ViewDidLoad` before custom renderers run and for routing through
`UpdateBackground`, which can delete externally applied gradient layers.
This change avoids both by design: the capture is lazy, and only
`BackgroundColor` is ever touched.

**Tests / evidence**

`ShellTabSwitchBackgroundTests` (iOS device test, Shell category, gated
to iOS/Catalyst 18+): builds a two-tab Shell, locates the
`UITabBarController` backing view, and asserts it adopts the displayed
page's opaque black background, then restores the captured default when
the background is cleared. No pixel sampling or display links involved.
Review follow-up (3fcfbae) extends this with preconfigured
backgrounds asserted across a real tab switch (no post-attach mutation),
the `Opacity < 1` exclusion sequence, and a second theory row that
registers the handler-based Shell so the `ShellItemHandler` path runs
too.

| | Without fix | With fix |
|---|---|---|
| iOS Shell category (iOS 26.5 simulator) | 508 of 510 passed; the only
2 failures are the new test under both Shell variants | 518 passed, 0
failed (with the extended coverage) |
| Frame scan of a two-tab black app on an iOS 18.5 simulator, ~11
switches | a grey event (3–4 mid-grey frames) at every switch | zero
grey frames; the cross-fade still runs |

**Before / after** (two-tab black sandbox app, iOS 18.5 simulator; both
stills are mid-cross-fade frames, the tab labels blended):

| Before: the page area washes grey during the switch | After: it stays
black, only the label fades |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.mp4)

### Issues Fixed

Fixes #39800

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 18, 2026
…40221)

### Description of Change

On iOS 18.x, switching Shell tabs flashes grey for a few frames even
when every page and Shell color is black.

`ShellItemRenderer` never sets its `UITabBarController` view's
background, so that view keeps UIKit's default, white in light mode. On
iOS 18 the tab controller cross-fades tab switches, and a probe built
into a two-tab black app caught UIKit fading a full-screen white
backdrop between the outgoing and incoming pages (opacity 0 → 0.89 over
4–5 frames). Black pages composited over white read as grey. Recoloring
that one view red turned the flash red; coloring it black made the flash
vanish while the native cross-fade kept running (401 animations over 10
switches, zero grey frames). iOS 26 doesn't cross-fade at all, which is
why the report is 18.x-specific.

The fix mirrors the displayed page's solid opaque background onto the
tab controller's view (and onto `PlatformView` in the handler path) on
iOS and Mac Catalyst 18+. It captures the previous color the first time
it overrides and restores it when the page background goes away.
Translucent colors, gradients and pages with `Opacity < 1` are left
alone.

The earlier WIP attempt (#39893) was flagged for capturing state at
`ViewDidLoad` before custom renderers run and for routing through
`UpdateBackground`, which can delete externally applied gradient layers.
This change avoids both by design: the capture is lazy, and only
`BackgroundColor` is ever touched.

**Tests / evidence**

`ShellTabSwitchBackgroundTests` (iOS device test, Shell category, gated
to iOS/Catalyst 18+): builds a two-tab Shell, locates the
`UITabBarController` backing view, and asserts it adopts the displayed
page's opaque black background, then restores the captured default when
the background is cleared. No pixel sampling or display links involved.
Review follow-up (3fcfbae) extends this with preconfigured
backgrounds asserted across a real tab switch (no post-attach mutation),
the `Opacity < 1` exclusion sequence, and a second theory row that
registers the handler-based Shell so the `ShellItemHandler` path runs
too.

| | Without fix | With fix |
|---|---|---|
| iOS Shell category (iOS 26.5 simulator) | 508 of 510 passed; the only
2 failures are the new test under both Shell variants | 518 passed, 0
failed (with the extended coverage) |
| Frame scan of a two-tab black app on an iOS 18.5 simulator, ~11
switches | a grey event (3–4 mid-grey frames) at every switch | zero
grey frames; the cross-fade still runs |

**Before / after** (two-tab black sandbox app, iOS 18.5 simulator; both
stills are mid-cross-fade frames, the tab labels blended):

| Before: the page area washes grey during the switch | After: it stays
black, only the label fades |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.mp4)

### Issues Fixed

Fixes #39800

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 19, 2026
…40221)

### Description of Change

On iOS 18.x, switching Shell tabs flashes grey for a few frames even
when every page and Shell color is black.

`ShellItemRenderer` never sets its `UITabBarController` view's
background, so that view keeps UIKit's default, white in light mode. On
iOS 18 the tab controller cross-fades tab switches, and a probe built
into a two-tab black app caught UIKit fading a full-screen white
backdrop between the outgoing and incoming pages (opacity 0 → 0.89 over
4–5 frames). Black pages composited over white read as grey. Recoloring
that one view red turned the flash red; coloring it black made the flash
vanish while the native cross-fade kept running (401 animations over 10
switches, zero grey frames). iOS 26 doesn't cross-fade at all, which is
why the report is 18.x-specific.

The fix mirrors the displayed page's solid opaque background onto the
tab controller's view (and onto `PlatformView` in the handler path) on
iOS and Mac Catalyst 18+. It captures the previous color the first time
it overrides and restores it when the page background goes away.
Translucent colors, gradients and pages with `Opacity < 1` are left
alone.

The earlier WIP attempt (#39893) was flagged for capturing state at
`ViewDidLoad` before custom renderers run and for routing through
`UpdateBackground`, which can delete externally applied gradient layers.
This change avoids both by design: the capture is lazy, and only
`BackgroundColor` is ever touched.

**Tests / evidence**

`ShellTabSwitchBackgroundTests` (iOS device test, Shell category, gated
to iOS/Catalyst 18+): builds a two-tab Shell, locates the
`UITabBarController` backing view, and asserts it adopts the displayed
page's opaque black background, then restores the captured default when
the background is cleared. No pixel sampling or display links involved.
Review follow-up (3fcfbae) extends this with preconfigured
backgrounds asserted across a real tab switch (no post-attach mutation),
the `Opacity < 1` exclusion sequence, and a second theory row that
registers the handler-based Shell so the `ShellItemHandler` path runs
too.

| | Without fix | With fix |
|---|---|---|
| iOS Shell category (iOS 26.5 simulator) | 508 of 510 passed; the only
2 failures are the new test under both Shell variants | 518 passed, 0
failed (with the extended coverage) |
| Frame scan of a two-tab black app on an iOS 18.5 simulator, ~11
switches | a grey event (3–4 mid-grey frames) at every switch | zero
grey frames; the cross-fade still runs |

**Before / after** (two-tab black sandbox app, iOS 18.5 simulator; both
stills are mid-cross-fade frames, the tab labels blended):

| Before: the page area washes grey during the switch | After: it stays
black, only the label fades |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.mp4)

### Issues Fixed

Fixes #39800

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 22, 2026
…40221)

### Description of Change

On iOS 18.x, switching Shell tabs flashes grey for a few frames even
when every page and Shell color is black.

`ShellItemRenderer` never sets its `UITabBarController` view's
background, so that view keeps UIKit's default, white in light mode. On
iOS 18 the tab controller cross-fades tab switches, and a probe built
into a two-tab black app caught UIKit fading a full-screen white
backdrop between the outgoing and incoming pages (opacity 0 → 0.89 over
4–5 frames). Black pages composited over white read as grey. Recoloring
that one view red turned the flash red; coloring it black made the flash
vanish while the native cross-fade kept running (401 animations over 10
switches, zero grey frames). iOS 26 doesn't cross-fade at all, which is
why the report is 18.x-specific.

The fix mirrors the displayed page's solid opaque background onto the
tab controller's view (and onto `PlatformView` in the handler path) on
iOS and Mac Catalyst 18+. It captures the previous color the first time
it overrides and restores it when the page background goes away.
Translucent colors, gradients and pages with `Opacity < 1` are left
alone.

The earlier WIP attempt (#39893) was flagged for capturing state at
`ViewDidLoad` before custom renderers run and for routing through
`UpdateBackground`, which can delete externally applied gradient layers.
This change avoids both by design: the capture is lazy, and only
`BackgroundColor` is ever touched.

**Tests / evidence**

`ShellTabSwitchBackgroundTests` (iOS device test, Shell category, gated
to iOS/Catalyst 18+): builds a two-tab Shell, locates the
`UITabBarController` backing view, and asserts it adopts the displayed
page's opaque black background, then restores the captured default when
the background is cleared. No pixel sampling or display links involved.
Review follow-up (3fcfbae) extends this with preconfigured
backgrounds asserted across a real tab switch (no post-attach mutation),
the `Opacity < 1` exclusion sequence, and a second theory row that
registers the handler-based Shell so the `ShellItemHandler` path runs
too.

| | Without fix | With fix |
|---|---|---|
| iOS Shell category (iOS 26.5 simulator) | 508 of 510 passed; the only
2 failures are the new test under both Shell variants | 518 passed, 0
failed (with the extended coverage) |
| Frame scan of a two-tab black app on an iOS 18.5 simulator, ~11
switches | a grey event (3–4 mid-grey frames) at every switch | zero
grey frames; the cross-fade still runs |

**Before / after** (two-tab black sandbox app, iOS 18.5 simulator; both
stills are mid-cross-fade frames, the tab labels blended):

| Before: the page area washes grey during the switch | After: it stays
black, only the label fades |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.mp4)

### Issues Fixed

Fixes #39800

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
kubaflo added a commit that referenced this pull request Nov 23, 2026
…40221)

### Description of Change

On iOS 18.x, switching Shell tabs flashes grey for a few frames even
when every page and Shell color is black.

`ShellItemRenderer` never sets its `UITabBarController` view's
background, so that view keeps UIKit's default, white in light mode. On
iOS 18 the tab controller cross-fades tab switches, and a probe built
into a two-tab black app caught UIKit fading a full-screen white
backdrop between the outgoing and incoming pages (opacity 0 → 0.89 over
4–5 frames). Black pages composited over white read as grey. Recoloring
that one view red turned the flash red; coloring it black made the flash
vanish while the native cross-fade kept running (401 animations over 10
switches, zero grey frames). iOS 26 doesn't cross-fade at all, which is
why the report is 18.x-specific.

The fix mirrors the displayed page's solid opaque background onto the
tab controller's view (and onto `PlatformView` in the handler path) on
iOS and Mac Catalyst 18+. It captures the previous color the first time
it overrides and restores it when the page background goes away.
Translucent colors, gradients and pages with `Opacity < 1` are left
alone.

The earlier WIP attempt (#39893) was flagged for capturing state at
`ViewDidLoad` before custom renderers run and for routing through
`UpdateBackground`, which can delete externally applied gradient layers.
This change avoids both by design: the capture is lazy, and only
`BackgroundColor` is ever touched.

**Tests / evidence**

`ShellTabSwitchBackgroundTests` (iOS device test, Shell category, gated
to iOS/Catalyst 18+): builds a two-tab Shell, locates the
`UITabBarController` backing view, and asserts it adopts the displayed
page's opaque black background, then restores the captured default when
the background is cleared. No pixel sampling or display links involved.
Review follow-up (3fcfbae) extends this with preconfigured
backgrounds asserted across a real tab switch (no post-attach mutation),
the `Opacity < 1` exclusion sequence, and a second theory row that
registers the handler-based Shell so the `ShellItemHandler` path runs
too.

| | Without fix | With fix |
|---|---|---|
| iOS Shell category (iOS 26.5 simulator) | 508 of 510 passed; the only
2 failures are the new test under both Shell variants | 518 passed, 0
failed (with the extended coverage) |
| Frame scan of a two-tab black app on an iOS 18.5 simulator, ~11
switches | a grey event (3–4 mid-grey frames) at every switch | zero
grey frames; the cross-fade still runs |

**Before / after** (two-tab black sandbox app, iOS 18.5 simulator; both
stills are mid-cross-fade frames, the tab labels blended):

| Before: the page area washes grey during the switch | After: it stays
black, only the label fades |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.mp4)

### Issues Fixed

Fixes #39800

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
KarthikRajaKalaimani pushed a commit to KarthikRajaKalaimani/maui that referenced this pull request Nov 26, 2026
…otnet#40221)

### Description of Change

On iOS 18.x, switching Shell tabs flashes grey for a few frames even
when every page and Shell color is black.

`ShellItemRenderer` never sets its `UITabBarController` view's
background, so that view keeps UIKit's default, white in light mode. On
iOS 18 the tab controller cross-fades tab switches, and a probe built
into a two-tab black app caught UIKit fading a full-screen white
backdrop between the outgoing and incoming pages (opacity 0 → 0.89 over
4–5 frames). Black pages composited over white read as grey. Recoloring
that one view red turned the flash red; coloring it black made the flash
vanish while the native cross-fade kept running (401 animations over 10
switches, zero grey frames). iOS 26 doesn't cross-fade at all, which is
why the report is 18.x-specific.

The fix mirrors the displayed page's solid opaque background onto the
tab controller's view (and onto `PlatformView` in the handler path) on
iOS and Mac Catalyst 18+. It captures the previous color the first time
it overrides and restores it when the page background goes away.
Translucent colors, gradients and pages with `Opacity < 1` are left
alone.

The earlier WIP attempt (dotnet#39893) was flagged for capturing state at
`ViewDidLoad` before custom renderers run and for routing through
`UpdateBackground`, which can delete externally applied gradient layers.
This change avoids both by design: the capture is lazy, and only
`BackgroundColor` is ever touched.

**Tests / evidence**

`ShellTabSwitchBackgroundTests` (iOS device test, Shell category, gated
to iOS/Catalyst 18+): builds a two-tab Shell, locates the
`UITabBarController` backing view, and asserts it adopts the displayed
page's opaque black background, then restores the captured default when
the background is cleared. No pixel sampling or display links involved.
Review follow-up (3fcfbae) extends this with preconfigured
backgrounds asserted across a real tab switch (no post-attach mutation),
the `Opacity < 1` exclusion sequence, and a second theory row that
registers the handler-based Shell so the `ShellItemHandler` path runs
too.

| | Without fix | With fix |
|---|---|---|
| iOS Shell category (iOS 26.5 simulator) | 508 of 510 passed; the only
2 failures are the new test under both Shell variants | 518 passed, 0
failed (with the extended coverage) |
| Frame scan of a two-tab black app on an iOS 18.5 simulator, ~11
switches | a grey event (3–4 mid-grey frames) at every switch | zero
grey frames; the cross-fade still runs |

**Before / after** (two-tab black sandbox app, iOS 18.5 simulator; both
stills are mid-cross-fade frames, the tab labels blended):

| Before: the page area washes grey during the switch | After: it stays
black, only the label fades |
|---|---|
|
![before](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.png)
|
![after](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.png)
|

Full clips:
[before.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-before.mp4)
·
[after.mp4](https://raw.githubusercontent.com/MykhailoDav/maui/media-pr-2026-11-12/39800-after.mp4)

### Issues Fixed

Fixes dotnet#39800

Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge Don't merge this PR partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Shell tab switching briefly flashes grey despite black page backgrounds

5 participants