Skip to content

[Android] Fix flyout item TextColor not applied from Label styles - #36616

Merged
kubaflo merged 5 commits into
inflight/currentfrom
fix/android-flyout-textcolor-3032719
Jul 17, 2026
Merged

kubaflo merged 5 commits into
inflight/currentfrom
fix/android-flyout-textcolor-3032719

Conversation

@StephaneDelcroix

@StephaneDelcroix StephaneDelcroix commented Jul 16, 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!

Description

Styling the text color of Shell flyout menu items did not work on Android, while it worked on iOS and Windows. This affects both:

In both cases the flyout item text stayed the default black on Android instead of picking up the user's color.

Root cause

BaseShellItem.CreateDefaultFlyoutItemCell builds the default flyout item template. On Android only, the default label text color was added to the Default_FlyoutItemLabelStyle class style:

defaultLabelClass.Setters.Add(new Setter { Property = Label.TextColorProperty, Value = textColor });

Class styles are applied at SetterSpecificity.StyleLocal (0x100):

  • A user's implicit Style TargetType="Label" is applied at StyleImplicit (0x080) → the framework default always won.
  • A user's flyout Class="FlyoutItemLabelStyle" style is applied at the same StyleLocal slot → the outcome depended on application order and the default won.

iOS/Windows don't set a default color in the class style, so user styles apply there — hence the platform inconsistency.

Fix

Apply the Android default flyout item text color directly on the label at the lowest specificity (new SetterSpecificity()), the same level used for CSS StyleSheet defaults (Element_StyleSheets.cs). The Material default color still shows when the user sets nothing, but any user style — implicit or explicit/class — now overrides it, matching iOS/Windows. FontSize, FontFamily, and Margin remain class-level (unchanged).

Tests

Added ShellTests device tests (run on all platforms — they lock the contract on iOS/Windows and validate the fix on Android):

Also verified the specificity mechanism against the real BindableObject value store (a value at new SetterSpecificity() shows when alone and is overridden by an implicit style), and confirmed the existing ShellFlyoutItemTemplateTests (8 tests) still pass.

No public API changes.

Fixes #18994

PureWeen and others added 4 commits July 15, 2026 15:26
…#36461)

> [!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!

## What this changes

Follow-up to #36317 (the self-watching `ci-status-fix` loop). Today,
when a `[ci-fix]` draft PR's CI comes back green — or red only on
**unrelated** flakes — the loop posts a comment but **leaves the PR as a
draft forever**. A maintainer has to notice it, confirm the specific
fixed test actually passed, and flip it to ready. In practice these
validated-green draft PRs sit unreviewed for weeks.

This PR adds a **target-test verification + mark-ready gate (Step 3.6)**
to both twins (`main` + `net11.0`). When a draft `[ci-fix]` /
`[ci-fix-net11]` PR reaches the green-surface or unrelated-flake branch,
the loop now drills into the PR's **own** AzDO test-results for the
**specific test(s)** the fix targeted. If every target test is `Passed`
on ≥1 leg and `Failed` on none (VALIDATED-GREEN), it:

- posts a `🎯 Target test validated green on <headSha>` comment (naming
the test + legs + buildId), and
- transitions the draft PR to **ready for review**.

This is a **state transition only** — it never approves and never
merges; a human still reviews and merges. Overall red on **unrelated**
legs no longer keeps a validated fix parked as a draft.

## How it works

- **Preconditions** (all required): PR `isDraft == true`; it is
unmistakably this workflow's own PR (`[ci-fix]`/`[ci-fix-net11]` title
prefix **and** `agentic-workflows` label); and it was reached from the
green or **unrelated-flake** path (never from caused-by-fix — that path
advances an attempt instead).
- **T1 — identify target test(s)** from the `[ci-scan]` issue signature
+ the PR diff. If no specific test can be identified (e.g. a product
build-break), it records a skip — build-only fixes are validated by
overall-green, which the existing green branch already handles.
- **T2 — drill AzDO test-results** for the build(s) on the PR's current
head SHA, filtered to the target test's `testCaseTitle`. A test that
never ran (e.g. an `/azp`-gated `maui-pr-uitests`/`maui-pr-devicetests`
leg that wasn't kicked) is **not** validated — the loop records an
honest "not yet executed" skip and does **not** mark ready. No
overclaiming: a green *sibling* leg is not the target test.
- **T3 — mark ready + report**, guarded by a per-head-SHA idempotency
marker and the existing `dry_run` gate (dry-run emits nothing and
tallies `would-mark-ready`).

## Safe-output

Adds the `mark-pull-request-as-ready-for-review` safe-output to both
twins (`max: 3`, `target: "*"`, `required-title-prefix` +
`required-labels`). Unlike `update-pull-request`, this output's
`required-*` guards **do** survive the gh-aw v0.80.9 compile (verified
against the generated locks), so which-PR scoping is enforced at the
handler level in addition to the Step 3.6 preconditions and
`min-integrity: approved`. No gh-aw version bump is required — the
capability already exists at our pinned v0.80.9.

## Enabling fix — the loop's own create-PR commit no longer counts as
"human engaged"

While validating this feature against #36429 I found the mark-ready path
was **unreachable for every loop-owned draft PR**, and traced it to a
regression from #36317's own review-hardening.

gh-aw's `create_pull_request` builds a PR's initial commit through the
GitHub API, which stamps `author=github-actions[bot]` but
**`committer=web-flow`**. Commit `2f6b77b330` (in #36317) removed
`web-flow` from the prefetch's bot-login denylist so a maintainer
"Update branch" would correctly hand the PR off — but that also made
`Test-AnyHumanCommitActor`'s committer check read the loop's **own**
first commit as human engagement. Result: every freshly opened
`[ci-fix]` draft PR computed `humanEngaged=true` from commit #1, so the
watch loop skipped it forever — never surfacing green, never marking
ready. This regression is live on `main` today (all four open loop-owned
draft PRs have `committer=web-flow`).

Fix (`Query-CiFixPRs.ps1`): a human **committer** only trips the
hand-off when the commit **author** is not one of this workflow's own
bot identities (`$LoopBotCommitAuthors`). A human **author** still
counts unconditionally, so maintainer direct commits and
web-flow-authored "Update branch" merges continue to hand off correctly.
Unit-tested across all six author/committer shapes.

## Validation

- Both twins recompiled with `gh aw compile` (0 errors / 0 warnings);
locks show no action-SHA or `compiler_version` drift (only
frontmatter/body hash + the new handler config).
- `mark_pull_request_as_ready_for_review` config confirmed present in
**both** locks with the correct `[ci-fix] ` / `[ci-fix-net11] ` prefixes
and `agentic-workflows` label; the `safe_outputs` job carries
`pull-requests: write`.
- Twin symmetry preserved (only `[ci-fix]` ↔ `[ci-fix-net11]` /
`ci-scan` ↔ `ci-scan-net11` token differences).
- **Live dry-run against #36429** (scoped `workflow_dispatch`,
`dry_run=true`, this branch): the workflow prefetch now computes
`humanEngaged=false` for #36429 (was `true` pre-fix), and the agent's
gate walk correctly advances **past** the human-engaged gate to the
CI-pending WAIT gate — `checksSettled=false` because #36429's macOS
`SafeAreaEdges` leg is still queued. Once that leg settles green, the
same run path reaches Step 3.6 and marks the PR ready. Emitted zero
writes (dry-run).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
…le grouped comments (#36533)

<!-- 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!

### What this changes

The `/review tests` **Test Failure Analysis** workflow classifies
whether a PR's CI failures are PR-caused or unrelated. Its deterministic
gate computed `legsRegressedVsBase` — the "Likely PR-caused" headline —
by comparing each red PR leg against **a single most-recent base
build**. Flaky UI-test legs that happened to be green on that one base
build produced false **"regressed-vs-base / Likely PR-caused"**
positives, so the generated comments carried little signal.

This PR makes the regression diff sample **several recent base builds of
the PR's own base branch** (`main` or `net11.0`) and only calls a leg a
regression when it is green across enough of them and red on none — and
switches the LLM engine to Opus. It also **replaces the per-test result
table with a skimmable, root-cause-grouped bullet list** (the
deep-UI-test-analysis style) so a run with hundreds of failures
collapses to a handful of readable groups inside the existing compact
badge + collapsible header instead of a giant table.

### Changes

- **`Gather-TestFailureContext.ps1`** — new `Get-AggregatedBaseLegMap`
aggregator + params `RegressionBaseBuilds=5` and
`MinBaseGreenSamples=2`. A leg is a regression only if it is green on
**≥ `MinBaseGreenSamples`** base builds **and red on NONE**. Per base
build, a leg that failed even one attempt counts RED (a retry that later
passed does not clear a base flake). New leg states `flaky-on-base` /
`succeeded-on-base-unconfirmed` and new per-failure fields
`baseSampleCount` / `baseGreenCount` / `baseFailedCount`.
- **Asymmetric conservatism (preserved)** — multi-build sampling widens
**only** the false-RED (assert-a-regression) side. The test-level
dismissal / false-GREEN side stays single-build-strict on purpose, so
this change never turns a real failure green.
- **`copilot-review-tests.md` / `.lock.yml`** — engine model
`claude-sonnet-4.6` → `claude-opus-4.8`; **replaced only the per-test
Markdown table** (an unreadable wall of text on runs with hundreds of
failures) with a deep-UI-test-analysis style **root-cause-grouped**
bullet list using subtle tokens (`✗ PR-related` / `ℹ Uncertain` / `●
Unrelated`). The compact **badge row and the `Test Failure Review:
[verdict] - click to expand` collapsible are kept** so the collapsed
comment stays a one-glance summary; the badge set now surfaces the key
multi-build signal — `Overall` / `Failures` / **`Regressed vs base`**
(replacing the old `Platform` badge) / `Baseline on base`. Everything
detailed (verdict sentence, grouped bullets, coverage counts, this-PR +
base-sampling build links, recommended action) lives inside the
collapsible. `img.shields.io` stays in the network allowlist. Lock
recompiled (gh-aw v0.80.9).
- **`SKILL.md` / `maui-ci-facts.md`** — document the multi-build
sampling, the new states/fields, and soften the "green on base is proof"
wording to require green across several base builds and red on none.

### Validation

Ran the gatherer locally against **PR #36478** (base `main`), before vs
after:

| | `legsRegressedVsBase` | Verdict |
|---|---|---|
| **Before** (single base build) | **14** | Not ready |
| **After** (5 base builds) | **0** | Needs human investigation |

The `ValidateDynamic*` (×9), `CollectionViewInfiniteScroll`, and
`Issue17400` legs — each green on 4/5 base builds and red on 1/5 — are
now correctly classified as `flaky-on-base` instead of PR regressions.

### Notes

- Extracted as a focused, standalone change from the broader
`improved-reviewer` work (#36473).
- CI-tooling-only change (`.github/`); no framework/runtime code is
touched.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… twin) (#36601)

> [!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!

## Problem

The **net11 twin** of the CI Failure Fixer (`ci-status-fix-net11`) has
been failing in its `safe_outputs` job on most scheduled runs since
~2026-07-10 (red on 07-10, 07-12, 07-13, 07-14, and 07-15 ×2). Every
failure is the same error:

```
Cannot create pull request: patch modifies files outside the allowed-files list
(src/AI/tests/Essentials.AI.UnitTests/...)
```

`net11.0` gained a new **`src/AI/`** source tree (Essentials.AI /
streaming-JSON) that **does not exist on `main`** (it 404s there). The
agent repeatedly finds a flaky `Essentials.AI.UnitTests` test, builds a
valid fix, and emits `create_pull_request` — but `src/AI/**` was never
added to the enforced `allowed-files` allowlist. The handler rejects the
patch, so:

- the whole scheduled run goes **red** every time,
- that AI-test flake can **never** be filed, and
- one create-PR slot is **burned** each sweep.

The `main` twin is unaffected because there is no `src/AI/` tree on
`main`.

## Fix

Add `src/AI/**` to **both** `allowed-files` blocks
(`create-pull-request` and `push-to-pull-request-branch`) in **both**
twins:

- On **net11.0** it unblocks the failing PR creation.
- On **main** it is a harmless no-op (no `src/AI/` tree exists there to
match) and keeps the two workflow files byte-identical per the
established mirror invariant — future-proofing a forward-port of the AI
tree.

Both `.lock.yml` files were recompiled with `gh aw compile` (0 errors /
0 warnings). The only substantive lock delta is the prepended
`"src/AI/**"` entry in the two `allowed_files` arrays (plus the metadata
hash line). No other handler config changed — `max` values, `add_labels
allowed:[p/0]`, `mark_pull_request_as_ready_for_review`,
`protected_files`, `base_branch`, and `title_prefix` are all unchanged.

## Verification

- `gh aw compile ci-status-fix` and `gh aw compile ci-status-fix-net11`
→ **0 errors / 0 warnings** each.
- Twin-symmetry invariant preserved (transformed-net11 vs main diff =
**124 lines**, the pre-existing cosmetic delta — unchanged by this PR).
- `gh aw lint` → no lint issues.
- Confirmed via lock diff that the sole config change is `"src/AI/**"`
prepended to the two `allowed_files` arrays in each twin.

Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
The default text color for Shell flyout items on Android was applied
through the "Default_FlyoutItemLabelStyle" class style, which is applied
at StyleLocal specificity. That outranks a user-provided implicit
"Style TargetType=Label", so changing a Label's TextColor via an implicit
style had no effect on flyout menu items on Android (it worked on
iOS/Windows, where no default color is set).

Apply the default flyout item text color directly on the label at the
lowest specificity (like a stylesheet default) so any user style -
implicit or explicit - overrides it, matching iOS/Windows.

Fixes DevDiv 3032719.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ae1ed716-6f37-4678-858a-9caf091478c5
Copilot AI review requested due to automatic review settings July 16, 2026 13:28
@github-actions

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 -- 36616

Or

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

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Cover the FlyoutItemLabelStyle class-style scenario from #18994 in addition
to the implicit-style scenario, both fixed by applying the Android default
flyout item text color at the lowest specificity.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ae1ed716-6f37-4678-858a-9caf091478c5
@StephaneDelcroix StephaneDelcroix changed the title Fix implicit Label style TextColor not applied to Shell flyout items on Android [Android] Fix flyout item TextColor not applied from Label styles Jul 16, 2026

Copilot AI 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.

Pull request overview

Fixes an Android-specific Shell flyout styling precedence issue where the default flyout item label TextColor (applied via a class style) always overrode user implicit Style TargetType="Label" TextColor. The fix applies the Android default TextColor directly to the flyout label at the lowest SetterSpecificity, aligning behavior with iOS/Windows and allowing user styles (implicit or explicit) to win.

Changes:

  • Android: move default flyout item label TextColor application from the Default_FlyoutItemLabelStyle class style to the label instance at new SetterSpecificity().
  • Add a device regression test ensuring an implicit Label style TextColor overrides the default flyout item label color.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Controls/src/Core/Shell/BaseShellItem.cs Applies Android default flyout label TextColor at the lowest specificity so implicit/explicit user styles override it.
src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutItemTextColorTests.cs Adds a device test validating implicit Label TextColor is honored for default Shell flyout item labels.

Copilot AI review requested due to automatic review settings July 16, 2026 13:32
@github-actions github-actions Bot added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Jul 16, 2026

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@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 Jul 16, 2026
@MauiBot MauiBot added s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Jul 16, 2026
MauiBot

This comment was marked as outdated.

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

kubaflo commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added s/agent-review-in-progress AI review is currently running for this PR and removed s/agent-review-in-progress AI review is currently running for this PR labels Jul 17, 2026
@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 Jul 17, 2026
MauiBot

This comment was marked as outdated.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Jul 17, 2026
@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 Jul 17, 2026
kubaflo pushed a commit that referenced this pull request Jul 17, 2026
…both sides)

When the SAME gate test hits an environment error (e.g. a device-test
XHarness exit 80 APP_CRASH) on BOTH the without-fix AND with-fix runs, the
fix cannot change the outcome — the gate is INCONCLUSIVE no matter what.
Each side already exhausted its per-test retry loop (3x with device
reboots), so a whole-gate retry just re-runs the identical both-sides crash
for the identical verdict.

android #36616 / build 14688269 burned ~92min running a persistent
Category=Shell APP_CRASH through 3 full A/B retries (6 runs x 13-20min) for
the same INCONCLUSIVE. Classify that as GATE-RETRY-CLASS: skip-permanent so
Review-PR.ps1's gate loop breaks after the first attempt.

Guarded to fire ONLY when EVERY env-errored gate test is two-sided: a
ONE-SIDED env error may be a transient flake that a retry can clear, so
those still fall through to the retry path. Snapshot-baseline permanent
signals and transient one-sided flakes are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 15d2af20-e4ab-4e88-9011-cfbd83513bc0
MauiBot

This comment was marked as outdated.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Jul 17, 2026
kubaflo pushed a commit that referenced this pull request Jul 17, 2026
The Copilot review gate verifies device-test PRs by running the test's whole
[Category] (e.g. Category=Shell). If any *unrelated* test in that category
APP_CRASHes (XHarness exit 80), the run dies on BOTH the with-fix and
without-fix sides, so the gate can only report INCONCLUSIVE — even though the
PR's own 1-2 target methods are fine (e.g. #36616, #36581, #36608).

XHarness's Xunit runner already supports an include filter by class
(TestRunner.SkipClass(fqcn, isExcluded:false) -> CreateClassFilter matches
ITypeInfo.Name == Type.FullName). This wires that up so the gate runs ONLY the
PR's test class, isolating the verdict from crashing siblings in the category.

Additive and safe:
- New, separate `IncludeClasses` host arg (Android instrumentation arg /
  iOS+MacCatalyst env via --set-env). The existing `TestFilter=Category=...`
  path is untouched, so the main maui-pr-devicetests pipeline and the Windows
  category parser are byte-identical (they never emit/read the new arg).
- Empty by default (TestOptions.IncludeClassNames = []), so normal runs skip
  the new code path entirely.
- Safe failure: if the FQCN matches 0 tests the run reports 0 tests ->
  INCONCLUSIVE, no worse than today.

Detect-TestsInDiff now derives the fully-qualified class name (namespace +
class) for DeviceTest groups and passes it through verify-tests-fail ->
Run-DeviceTests as `IncludeClasses`, while $group.Filter still carries the
whole-Category value for Windows and fallback. Wired for Core + Controls
device tests (Android + iOS/MacCatalyst); Windows keeps category behaviour.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 15d2af20-e4ab-4e88-9011-cfbd83513bc0
MauiBot

This comment was marked as outdated.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Expert Review — 3 findings

See inline comments for details.

if (Application.Current == null)
{
textColor = Colors.Black.MultiplyAlpha(0.87f);
label.SetValue(Label.TextColorProperty, Colors.Black.MultiplyAlpha(0.87f), new SetterSpecificity());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔍 AI-Generated Review (multi-model)

[minor] Complexity Reduction / Readability — new SetterSpecificity() is used here (and again at line 530) to mean "lowest/default specificity", but SetterSpecificity already exposes a named public static readonly SetterSpecificity DefaultValue = new SetterSpecificity(0); for exactly this value. Using SetterSpecificity.DefaultValue instead of the parameterless constructor would make the intent ("apply at the lowest possible priority, like a stylesheet default") self-documenting and match the file's own explanatory comment, rather than relying on the reader knowing that the struct's default equals DefaultValue.


Assert.Equal(Colors.Red, label.TextColor);
});
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔍 AI-Generated Review (multi-model)

[moderate] Regression Prevention / Test Coverage — Both tests assert that a user Style overrides the default color, but neither verifies the baseline (no user style) case still gets the correct Android default color (Colors.Black.MultiplyAlpha(0.87f) in light theme / Colors.White in dark, via the AppThemeBinding). Since this PR changes how the default is applied (direct SetValue/SetBinding at DefaultValue specificity instead of a Setter in Default_FlyoutItemLabelStyle), a regression in the specificity plumbing could silently make the default fall through to Colors.Default/black with no override present, and none of the current tests would catch it. Consider adding a third test that creates a FlyoutItem with no Label styles in Resources and asserts label.TextColor still equals the expected default (for at least the light-theme case).

defaultLabelClass.Setters.Add(new Setter { Property = Label.FontFamilyProperty, Value = "sans-serif-medium" });
defaultLabelClass.Setters.Add(new Setter { Property = Label.MarginProperty, Value = new Thickness(20, 0, 0, 0) });

// Apply the default flyout item text color at the lowest specificity (like a stylesheet default)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🔍 AI-Generated Review (multi-model)

[minor] Backward Compatibility — This intentionally changes Android's default flyout behavior: previously, Default_FlyoutItemLabelStyle was applied at StyleLocal specificity, so it always beat an app-wide implicit Style TargetType="Label" and the flyout kept its own default color regardless of that global style. After this change, any pre-existing implicit Label style in an app will now also color flyout item labels (matching iOS/Windows, and fixing the reported bugs, but a real visual change for apps that already had an implicit Label style and were relying on the old Android-only default color). Worth calling out explicitly in the PR description/release notes as an intentional, documented behavior change rather than a silent one, since it's not otherwise flagged as a breaking/behavioral change in this diff.

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review Summary

@StephaneDelcroix — new AI review results are available based on this last commit: 09ca9d2. To request a fresh review after new comments or commits, comment /review rerun.

Gate Inconclusive Confidence Low Platform Android


🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix

Gate Result: ⚠️ INCONCLUSIVE

Platform: ANDROID · Base: main · Merge base: 0188c0c6

Test Without Fix (expect FAIL) With Fix (expect PASS)
📱 ShellTests (ImplicitLabelStyleOverridesDefaultFlyoutItemTextColor, FlyoutItemLabelClassStyleOverridesDefaultFlyoutItemTextColor) Category=Shell ⚠️ ENV ERROR ⚠️ ENV ERROR
🔴 Without fix — 📱 ShellTests (ImplicitLabelStyleOverridesDefaultFlyoutItemTextColor, FlyoutItemLabelClassStyleOverridesDefaultFlyoutItemTextColor): ⚠️ ENV ERROR · 1669s

(no coded error found; showing last 1200 chars)


      
      
�[41m�[1m�[37mcrit�[39m�[22m�[49m: Install failure: Test command cannot continue
�[40m�[32minfo�[39m�[22m�[49m: Attempting to remove apk 'com.microsoft.maui.controls.devicetests'..
�[40m�[37mdbug�[39m�[22m�[49m: Executing command: '/home/vsts/.nuget/packages/microsoft.dotnet.xharness.cli/11.0.0-prerelease.26230.4/runtimes/any/native/adb/linux/adb -s emulator-5554 uninstall com.microsoft.maui.controls.devicetests'
�[41m�[30mfail�[39m�[22m�[49m: Error: Exit code: 20
      Std out:
      
      
      Std err:
      - waiting for device -
      cmd: Can't find service: package
      
      
      
�[40m�[32minfo�[39m�[22m�[49m: Attempting to remove apk 'com.microsoft.maui.controls.devicetests'..
�[40m�[37mdbug�[39m�[22m�[49m: Executing command: '/home/vsts/.nuget/packages/microsoft.dotnet.xharness.cli/11.0.0-prerelease.26230.4/runtimes/any/native/adb/linux/adb -s emulator-5554 uninstall com.microsoft.maui.controls.devicetests'
�[41m�[30mfail�[39m�[22m�[49m: Error: Exit code: 20
      Std out:
      
      
      Std err:
      cmd: Can't find service: package
      
      
      
XHarness exit code: 78 (PACKAGE_INSTALLATION_FAILURE)
  Tests completed with exit code: 78

🟢 With fix — 📱 ShellTests (ImplicitLabelStyleOverridesDefaultFlyoutItemTextColor, FlyoutItemLabelClassStyleOverridesDefaultFlyoutItemTextColor): ⚠️ ENV ERROR · 786s

(no coded error found; showing last 1200 chars)

i.controls.devicetests.zip
�[40m�[32minfo�[39m�[22m�[49m: <<XHARNESS_RESULT_START>>
      {
        "version": 1,
        "machineName": "runnervm6ochl",
        "exitCode": 80,
        "exitCodeName": "APP_CRASH",
        "platform": "android",
        "device": "emulator-5554",
        "deviceOsVersion": "API 30",
        "architecture": "x86_64",
        "files": [
          {
            "name": "adb-logcat-com.microsoft.maui.controls.devicetests-default.log",
            "type": "logcat"
          },
          {
            "name": "adb-bugreport-com.microsoft.maui.controls.devicetests.zip",
            "type": "bugreport"
          }
        ]
      }
      <<XHARNESS_RESULT_END>>
�[40m�[32minfo�[39m�[22m�[49m: Attempting to remove apk 'com.microsoft.maui.controls.devicetests'..
�[40m�[37mdbug�[39m�[22m�[49m: Executing command: '/home/vsts/.nuget/packages/microsoft.dotnet.xharness.cli/11.0.0-prerelease.26230.4/runtimes/any/native/adb/linux/adb -s emulator-5554 uninstall com.microsoft.maui.controls.devicetests'
�[40m�[32minfo�[39m�[22m�[49m: Successfully uninstalled com.microsoft.maui.controls.devicetests
XHarness exit code: 80 (APP_CRASH)
  Tests completed with exit code: 80

⚠️ Failure Details

  • ⚠️ ShellTests (ImplicitLabelStyleOverridesDefaultFlyoutItemTextColor, FlyoutItemLabelClassStyleOverridesDefaultFlyoutItemTextColor) without fix: App crashed during test run (XHarness exit 80 APP_CRASH)
  • ⚠️ ShellTests (ImplicitLabelStyleOverridesDefaultFlyoutItemTextColor, FlyoutItemLabelClassStyleOverridesDefaultFlyoutItemTextColor) with fix: App crashed during test run (XHarness exit 80 APP_CRASH)
📁 Fix files reverted (1 files)
  • src/Controls/src/Core/Shell/BaseShellItem.cs

📱 UI Tests — Shell

Detected UI test categories: Shell

✅ Deep UI tests — 309 passed, 0 failed across 1 category on platform-pool agent (replaces in-process counts above).

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
Shell 309/309 ✓ —
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

📋 Pre-Flight — Context & Validation

Issue: #18994 - [regression/8.0.3] FlyoutItem and MenuItem styles don't work
PR: #36616 - [Android] Fix flyout item TextColor not applied from Label styles
Platforms Affected: Android
Files Changed: 1 implementation, 1 test

Key Findings

  • Android's default Shell flyout template applied Label.TextColor through the Default_FlyoutItemLabelStyle class, giving it style-local specificity that outranked implicit Label styles and competed with FlyoutItem.LabelStyle class styles.
  • The PR changes only the default Android TextColor path; other default flyout label properties remain class-style based.
  • Regression coverage was added for implicit Label styles and FlyoutItemLabelStyle class styles.

Code Review Summary

Verdict: NEEDS_DISCUSSION
Confidence: low
Errors: 0 | Warnings: 0 | Suggestions: 0

Key code review findings:

  • ℹ No code findings. The independent review found the approach localized and consistent with the PR narrative, but CI/gate evidence remains undetermined in this environment.

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #36616 Apply Android default flyout item TextColor directly to the generated Label at lowest SetterSpecificity, allowing implicit and class styles to override it. ⚠️ INCONCLUSIVE (Gate) src/Controls/src/Core/Shell/BaseShellItem.cs, src/Controls/tests/DeviceTests/Elements/Shell/ShellFlyoutItemTextColorTests.cs Original PR; gate build/run was inconclusive and must not be treated as failing.

🔬 Code Review — Deep Analysis

Code Review — PR #36616

Independent Assessment

What this changes: Android Shell flyout labels now receive the framework default TextColor directly on the generated Label at lowest SetterSpecificity, instead of through Default_FlyoutItemLabelStyle.
Inferred motivation: Let user implicit Label styles and FlyoutItemLabelStyle class styles override Android’s default flyout text color.

Reconciliation with PR Narrative

Author claims: Fixes Android-only Shell flyout TextColor style precedence for implicit Label styles and FlyoutItemLabelStyle, with regression device tests.
Agreement/disagreement: Agrees. The code matches the stated specificity issue.

Prior Review Reconciliation

No prior ❌ Error findings found. Prior bot reviews/gate summaries reported CI/gate failures and one coverage warning, but no unresolved code-blocking review finding.

Blast Radius Assessment

  • Runs for all instances: Android default Shell flyout template only.
  • Startup impact: No; template creation path, not app startup.
  • Static/shared state: No.

CI Status

  • Required-check result: gh pr checks --required unavailable (gh auth login required). Public check-run fallback shows maui-pr and maui-pr-devicetests success, but maui-pr-uitests and Build Analysis failing.
  • Classification: undetermined.
  • Action taken: Invoked azdo-build-investigator; ci-analysis skill unavailable in this environment. Confidence capped low.

Findings

No code findings. maui-expert-reviewer produced no findings; its required inline-findings.json was []. No GitHub comments were posted.

Failure-Mode Probing

  • No user style: default Android color remains set at BaseShellItem.cs:523-530.
  • User implicit/class style: style specificity exceeds lowest SetterSpecificity, so user TextColor wins.
  • Null/default values: no new nullable state or handler lifecycle subscription introduced.

Verdict: NEEDS_DISCUSSION

Confidence: low
Summary: Code approach looks sound and localized, with tests covering both targeted style cases. Cannot LGTM because required CI could not be queried with gh and public checks are red/undetermined.


🛠️ Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
1 try-fix Remove Android default flyout label TextColor entirely. ⚠️ BLOCKED 1 file Not better: drops default/dark-theme behavior.
2 try-fix Keep class-style default only when Application/Shell resources do not predefine Label/FlyoutItemLabelStyle TextColor. ⚠️ BLOCKED 1 file Not better: brittle resource pre-scan. Build succeeded; run timed out during instrumentation.
3 try-fix After style classes apply, set Android default only if generated label TextColor remains unset. ❌ FAIL 1 file New regression tests failed; fallback default still overrode user styles.
PR PR #36616 Apply Android default flyout item TextColor directly to the generated Label at lowest SetterSpecificity. ⚠️ INCONCLUSIVE (Gate) 2 files Best code approach found; preserves default while composing with MAUI style specificity.

Learn Loop

Round Input from previous attempt New approach Outcome
1 PR approach uses low-specificity default. Try removing the default entirely. Blocked; self-review found default behavior regression.
2 Need preserve no-user-style default. Try pre-detecting user TextColor styles and suppressing default. Blocked; self-review found resource/style lookup brittleness.
3 Need avoid pre-scanning resources. Try post-style fallback based on actual Label state. Failed; regression tests still saw Android default overriding Red.

Failure Evidence

  • try-fix-1: Android test command hung without output and was stopped; self-review found the approach behaviorally incomplete.
  • try-fix-2: Android build succeeded, emulator emulator-5554 was ready, APK installed, but the bounded run timed out during instrumentation; self-review found the approach incomplete.
  • try-fix-3: Android Shell tests executed and failed ImplicitLabelStyleOverridesDefaultFlyoutItemTextColor and FlyoutItemLabelClassStyleOverridesDefaultFlyoutItemTextColor; actual color was [Color: Red=0, Green=0, Blue=0, Alpha=0.87], expected Red.

Cross-Pollination

Model/Reviewer Round New Ideas? Details
code-review + MAUI expert rules Pre-flight Yes No PR code findings; advised style-specificity and Android default preservation are the key constraints.
MAUI expert self-review 1 Yes Removing the default is incomplete; next candidate must preserve no-user-style default.
MAUI expert self-review 2 Yes Resource pre-scan is brittle; next candidate should observe actual applied style state.
MAUI expert self-review + test output 3 No Post-style local fallback still fails regression tests; remaining viable solution is the PR specificity approach, not a trivial variation.

Exhausted: Yes
Selected Fix: PR #36616 — it is the only approach that preserves Android default coloring while allowing both implicit Label styles and FlyoutItemLabelStyle class styles to override via MAUI specificity. No alternative candidate passed all tests or was demonstrably better.


🏁 Report — Final Recommendation

Comparative Fix Report — PR #36616

Candidates compared

Candidate Approach Regression evidence Rank
pr Apply Android default flyout item TextColor directly to the generated Label at lowest SetterSpecificity, leaving other default flyout label properties in the default class style. ⚠️ Gate inconclusive due to environment errors; no code-review findings. 1
pr-plus-reviewer Same as pr; expert reviewer produced no actionable feedback to apply. ⚠️ Same as pr; no code-review findings. 1
try-fix-2 Keep the default class-style color only when a resource pre-scan does not find competing styles. ⚠️ Blocked by instrumentation timeout; self-review found the approach brittle and incomplete. 3
try-fix-1 Remove Android default flyout label TextColor entirely. ⚠️ Blocked by no-output Android run; self-review found a default/dark-theme behavior regression. 4
try-fix-3 Apply a post-style fallback default only if the label appears unset. ❌ Failed both new regression tests; observed default black instead of user red. 5

Analysis

try-fix-3 must rank below non-failing candidates because it failed the regression tests for both target scenarios. try-fix-1 and try-fix-2 did not produce a passing regression signal and have clear design regressions: removing the default loses Android's no-user-style behavior, while resource pre-scanning misses legitimate style sources and timing changes.

The PR approach best matches MAUI's existing specificity model. new SetterSpecificity() is intentionally used by stylesheet defaults and is lower than implicit Style TargetType="Label" and class styles, so it solves the precedence bug while preserving the Android default value and app-theme behavior. The expert reviewer found no actionable issues, so pr-plus-reviewer is functionally identical to pr.

Winner

Winner: pr

pr and pr-plus-reviewer are equivalent because no reviewer changes were needed. The raw PR fix is selected as the single winner because it is the simplest viable implementation, directly addresses the root cause, preserves existing default behavior, and avoids the failed or brittle alternatives from STEP 5a.


🧭 Next Steps — review latest findings

No alternative fix was selected for this run. Review the session findings and CI results before merging.

@kubaflo
kubaflo changed the base branch from main to inflight/current July 17, 2026 20:13
@kubaflo
kubaflo merged commit a5902da into inflight/current Jul 17, 2026
146 of 165 checks passed
@kubaflo
kubaflo deleted the fix/android-flyout-textcolor-3032719 branch July 17, 2026 20:14
@github-actions github-actions Bot added this to the .NET 10 SR10 milestone Jul 17, 2026
kubaflo added a commit that referenced this pull request Jul 22, 2026
…6616)

> [!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!

Styling the text color of **Shell flyout menu items** did not work on
**Android**, while it worked on iOS and Windows. This affects both:

- an implicit `Style TargetType="Label"` that sets `TextColor` (reported
internally as DevDiv 3032719), and
- a `Style ... Class="FlyoutItemLabelStyle"` that sets `TextColor`
(#18994).

In both cases the flyout item text stayed the default black on Android
instead of picking up the user's color.

`BaseShellItem.CreateDefaultFlyoutItemCell` builds the default flyout
item template. On **Android only**, the default label text color was
added to the `Default_FlyoutItemLabelStyle` **class** style:

```csharp
defaultLabelClass.Setters.Add(new Setter { Property = Label.TextColorProperty, Value = textColor });
```

Class styles are applied at `SetterSpecificity.StyleLocal` (`0x100`):

- A user's implicit `Style TargetType="Label"` is applied at
`StyleImplicit` (`0x080`) → the framework default always won.
- A user's flyout `Class="FlyoutItemLabelStyle"` style is applied at the
*same* `StyleLocal` slot → the outcome depended on application order and
the default won.

iOS/Windows don't set a default color in the class style, so user styles
apply there — hence the platform inconsistency.

Apply the Android default flyout item text color **directly on the label
at the lowest specificity** (`new SetterSpecificity()`), the same level
used for CSS `StyleSheet` defaults (`Element_StyleSheets.cs`). The
Material default color still shows when the user sets nothing, but
**any** user style — implicit or explicit/class — now overrides it,
matching iOS/Windows. `FontSize`, `FontFamily`, and `Margin` remain
class-level (unchanged).

Added `ShellTests` device tests (run on all platforms — they lock the
contract on iOS/Windows and validate the fix on Android):

- `ImplicitLabelStyleOverridesDefaultFlyoutItemTextColor` — implicit
`Style TargetType="Label"` (DevDiv 3032719).
- `FlyoutItemLabelClassStyleOverridesDefaultFlyoutItemTextColor` —
`Class="FlyoutItemLabelStyle"` style (#18994).

Also verified the specificity mechanism against the real
`BindableObject` value store (a value at `new SetterSpecificity()` shows
when alone and is overridden by an implicit style), and confirmed the
existing `ShellFlyoutItemTemplateTests` (8 tests) still pass.

No public API changes.

Fixes #18994

---------

Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Jul 28, 2026
…6616)

> [!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!

Styling the text color of **Shell flyout menu items** did not work on
**Android**, while it worked on iOS and Windows. This affects both:

- an implicit `Style TargetType="Label"` that sets `TextColor` (reported
internally as DevDiv 3032719), and
- a `Style ... Class="FlyoutItemLabelStyle"` that sets `TextColor`
(#18994).

In both cases the flyout item text stayed the default black on Android
instead of picking up the user's color.

`BaseShellItem.CreateDefaultFlyoutItemCell` builds the default flyout
item template. On **Android only**, the default label text color was
added to the `Default_FlyoutItemLabelStyle` **class** style:

```csharp
defaultLabelClass.Setters.Add(new Setter { Property = Label.TextColorProperty, Value = textColor });
```

Class styles are applied at `SetterSpecificity.StyleLocal` (`0x100`):

- A user's implicit `Style TargetType="Label"` is applied at
`StyleImplicit` (`0x080`) → the framework default always won.
- A user's flyout `Class="FlyoutItemLabelStyle"` style is applied at the
*same* `StyleLocal` slot → the outcome depended on application order and
the default won.

iOS/Windows don't set a default color in the class style, so user styles
apply there — hence the platform inconsistency.

Apply the Android default flyout item text color **directly on the label
at the lowest specificity** (`new SetterSpecificity()`), the same level
used for CSS `StyleSheet` defaults (`Element_StyleSheets.cs`). The
Material default color still shows when the user sets nothing, but
**any** user style — implicit or explicit/class — now overrides it,
matching iOS/Windows. `FontSize`, `FontFamily`, and `Margin` remain
class-level (unchanged).

Added `ShellTests` device tests (run on all platforms — they lock the
contract on iOS/Windows and validate the fix on Android):

- `ImplicitLabelStyleOverridesDefaultFlyoutItemTextColor` — implicit
`Style TargetType="Label"` (DevDiv 3032719).
- `FlyoutItemLabelClassStyleOverridesDefaultFlyoutItemTextColor` —
`Class="FlyoutItemLabelStyle"` style (#18994).

Also verified the specificity mechanism against the real
`BindableObject` value store (a value at `new SetterSpecificity()` shows
when alone and is overridden by an implicit style), and confirmed the
existing `ShellFlyoutItemTemplateTests` (8 tests) still pass.

No public API changes.

Fixes #18994

---------

Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Jul 29, 2026
…6616)

> [!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!

Styling the text color of **Shell flyout menu items** did not work on
**Android**, while it worked on iOS and Windows. This affects both:

- an implicit `Style TargetType="Label"` that sets `TextColor` (reported
internally as DevDiv 3032719), and
- a `Style ... Class="FlyoutItemLabelStyle"` that sets `TextColor`
(#18994).

In both cases the flyout item text stayed the default black on Android
instead of picking up the user's color.

`BaseShellItem.CreateDefaultFlyoutItemCell` builds the default flyout
item template. On **Android only**, the default label text color was
added to the `Default_FlyoutItemLabelStyle` **class** style:

```csharp
defaultLabelClass.Setters.Add(new Setter { Property = Label.TextColorProperty, Value = textColor });
```

Class styles are applied at `SetterSpecificity.StyleLocal` (`0x100`):

- A user's implicit `Style TargetType="Label"` is applied at
`StyleImplicit` (`0x080`) → the framework default always won.
- A user's flyout `Class="FlyoutItemLabelStyle"` style is applied at the
*same* `StyleLocal` slot → the outcome depended on application order and
the default won.

iOS/Windows don't set a default color in the class style, so user styles
apply there — hence the platform inconsistency.

Apply the Android default flyout item text color **directly on the label
at the lowest specificity** (`new SetterSpecificity()`), the same level
used for CSS `StyleSheet` defaults (`Element_StyleSheets.cs`). The
Material default color still shows when the user sets nothing, but
**any** user style — implicit or explicit/class — now overrides it,
matching iOS/Windows. `FontSize`, `FontFamily`, and `Margin` remain
class-level (unchanged).

Added `ShellTests` device tests (run on all platforms — they lock the
contract on iOS/Windows and validate the fix on Android):

- `ImplicitLabelStyleOverridesDefaultFlyoutItemTextColor` — implicit
`Style TargetType="Label"` (DevDiv 3032719).
- `FlyoutItemLabelClassStyleOverridesDefaultFlyoutItemTextColor` —
`Class="FlyoutItemLabelStyle"` style (#18994).

Also verified the specificity mechanism against the real
`BindableObject` value store (a value at `new SetterSpecificity()` shows
when alone and is overridden by an implicit style), and confirmed the
existing `ShellFlyoutItemTemplateTests` (8 tests) still pass.

No public API changes.

Fixes #18994

---------

Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Aug 7, 2026
…6616)

> [!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!

Styling the text color of **Shell flyout menu items** did not work on
**Android**, while it worked on iOS and Windows. This affects both:

- an implicit `Style TargetType="Label"` that sets `TextColor` (reported
internally as DevDiv 3032719), and
- a `Style ... Class="FlyoutItemLabelStyle"` that sets `TextColor`
(#18994).

In both cases the flyout item text stayed the default black on Android
instead of picking up the user's color.

`BaseShellItem.CreateDefaultFlyoutItemCell` builds the default flyout
item template. On **Android only**, the default label text color was
added to the `Default_FlyoutItemLabelStyle` **class** style:

```csharp
defaultLabelClass.Setters.Add(new Setter { Property = Label.TextColorProperty, Value = textColor });
```

Class styles are applied at `SetterSpecificity.StyleLocal` (`0x100`):

- A user's implicit `Style TargetType="Label"` is applied at
`StyleImplicit` (`0x080`) → the framework default always won.
- A user's flyout `Class="FlyoutItemLabelStyle"` style is applied at the
*same* `StyleLocal` slot → the outcome depended on application order and
the default won.

iOS/Windows don't set a default color in the class style, so user styles
apply there — hence the platform inconsistency.

Apply the Android default flyout item text color **directly on the label
at the lowest specificity** (`new SetterSpecificity()`), the same level
used for CSS `StyleSheet` defaults (`Element_StyleSheets.cs`). The
Material default color still shows when the user sets nothing, but
**any** user style — implicit or explicit/class — now overrides it,
matching iOS/Windows. `FontSize`, `FontFamily`, and `Margin` remain
class-level (unchanged).

Added `ShellTests` device tests (run on all platforms — they lock the
contract on iOS/Windows and validate the fix on Android):

- `ImplicitLabelStyleOverridesDefaultFlyoutItemTextColor` — implicit
`Style TargetType="Label"` (DevDiv 3032719).
- `FlyoutItemLabelClassStyleOverridesDefaultFlyoutItemTextColor` —
`Class="FlyoutItemLabelStyle"` style (#18994).

Also verified the specificity mechanism against the real
`BindableObject` value store (a value at `new SetterSpecificity()` shows
when alone and is overridden by an implicit style), and confirmed the
existing `ShellFlyoutItemTemplateTests` (8 tests) still pass.

No public API changes.

Fixes #18994

---------

Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Aug 12, 2026
…6616)

> [!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!

Styling the text color of **Shell flyout menu items** did not work on
**Android**, while it worked on iOS and Windows. This affects both:

- an implicit `Style TargetType="Label"` that sets `TextColor` (reported
internally as DevDiv 3032719), and
- a `Style ... Class="FlyoutItemLabelStyle"` that sets `TextColor`
(#18994).

In both cases the flyout item text stayed the default black on Android
instead of picking up the user's color.

`BaseShellItem.CreateDefaultFlyoutItemCell` builds the default flyout
item template. On **Android only**, the default label text color was
added to the `Default_FlyoutItemLabelStyle` **class** style:

```csharp
defaultLabelClass.Setters.Add(new Setter { Property = Label.TextColorProperty, Value = textColor });
```

Class styles are applied at `SetterSpecificity.StyleLocal` (`0x100`):

- A user's implicit `Style TargetType="Label"` is applied at
`StyleImplicit` (`0x080`) → the framework default always won.
- A user's flyout `Class="FlyoutItemLabelStyle"` style is applied at the
*same* `StyleLocal` slot → the outcome depended on application order and
the default won.

iOS/Windows don't set a default color in the class style, so user styles
apply there — hence the platform inconsistency.

Apply the Android default flyout item text color **directly on the label
at the lowest specificity** (`new SetterSpecificity()`), the same level
used for CSS `StyleSheet` defaults (`Element_StyleSheets.cs`). The
Material default color still shows when the user sets nothing, but
**any** user style — implicit or explicit/class — now overrides it,
matching iOS/Windows. `FontSize`, `FontFamily`, and `Margin` remain
class-level (unchanged).

Added `ShellTests` device tests (run on all platforms — they lock the
contract on iOS/Windows and validate the fix on Android):

- `ImplicitLabelStyleOverridesDefaultFlyoutItemTextColor` — implicit
`Style TargetType="Label"` (DevDiv 3032719).
- `FlyoutItemLabelClassStyleOverridesDefaultFlyoutItemTextColor` —
`Class="FlyoutItemLabelStyle"` style (#18994).

Also verified the specificity mechanism against the real
`BindableObject` value store (a value at `new SetterSpecificity()` shows
when alone and is overridden by an implicit style), and confirmed the
existing `ShellFlyoutItemTemplateTests` (8 tests) still pass.

No public API changes.

Fixes #18994

---------

Co-authored-by: Shane Neuville <5375137+PureWeen@users.noreply.github.com>
Co-authored-by: PureWeen <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 17, 2026
@sheiksyedm sheiksyedm modified the milestones: .NET 10 SR10, .NET 10 SR11 Aug 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-shell Shell Navigation, Routes, Tabs, Flyout s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[regression/8.0.3] FlyoutItem and MenuItem styles don't work

6 participants