Skip to content

fix(menu, banner)!: use surfaceContainer roles for background - #5121

Open
hristototov wants to merge 10 commits into
mainfrom
hristototov/surface-semantic-container-color
Open

hristototov wants to merge 10 commits into
mainfrom
hristototov/surface-semantic-container-color

Conversation

@hristototov

@hristototov hristototov commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Menu and Banner take their background from theme.colors.elevation, which the dynamic themes don't override. On Android 14+ with DynamicLightTheme and DynamicDarkTheme they keep the static tint instead of the system surface colors.

Menu now uses surfaceContainer and Banner surfaceContainerLow, passed through Surface's existing backgroundColor. elevation only controls the shadow. With LightTheme and DarkTheme they look the same. Breaking for apps that customized elevation.level1 or elevation.level2 to style Banner or Menu; the migration guide covers it.

Related issue

Part of #5119

Screenshots / Videos

light-mode.mov
dark-mode.mov

Test plan

  1. Android 14+, dynamic theme: Menu and Banner use the system surface colors.
  2. Banner example: "Set custom theme" shows light text on a dark background.

@hristototov
hristototov requested review from JKobrynski, adrcotfas and satya164 and removed request for JKobrynski and satya164 September 14, 2026 12:29

@JKobrynski JKobrynski 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.

LGTM, @satya164

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…into hristototov/surface-semantic-container-color
@satya164

satya164 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review by Claude

iOS

Banner text is unreadable with the custom theme in the Banner example. (via Claude, verify if it makes sense)

  1. Open the Banner example.
  2. Press "Set custom theme".

What happens: the text turns near white (onSurface: Palette.tertiary100) but the background stays the light surfaceContainerLow. The example overrides colors.elevation.level1 for the background, and Banner no longer reads it.

What should happen: the banner shows the dark tertiary background with light text, like on main. Change the example to override surfaceContainerLow instead of elevation.level1.

iOS, Banner example with custom theme: white text on light background

Surface example: role labels break mid-word and two tiles are invisible. (via Claude, verify if it makes sense)

  1. Open the Surface example.
  2. Scroll the "Semantic container colors" row.

What happens: surfaceContainerLowest and surfaceContainerLow wrap as "surfaceContainerLo / west" and "surfaceContainerLo / w" in the 120 pt tiles. The surface and surfaceBright tiles have the same color as the screen background, so they look like plain text with no tile.

What should happen: each label fits on its own line and each tile is visible against the screen background, for example with a border or mode="elevated".

iOS, Surface example: surface and surfaceBright tiles blend into the screen
iOS, Surface example: labels wrap mid-word

Android

Banner text is unreadable with the custom theme in the Banner example. (via Claude, verify if it makes sense)

Same steps and cause as on iOS.

Android, PR: custom theme, white text on light background
Android, main: custom theme, tertiary background

With the dynamic theme, Banner and Menu change color compared to main. (via Claude, verify if it makes sense)

  1. Use the example app on Android 12 or newer, where it uses DynamicLightTheme by default.
  2. Open the Banner example.

What happens: the background now uses the wallpaper based system_surface_container_* colors. On main it used colors.elevation.level1 and level2, which DynamicLightTheme and DynamicDarkTheme keep from the static theme. The color change itself is fine, but the migration guide says "the rendered color is unchanged", which is not true for the dynamic themes.

What should happen: the migration guide says that the color changes when you use the dynamic themes on Android.

Android, PR: Banner with dynamic theme
Android, main: Banner with dynamic theme

Web

Banner text is unreadable with the custom theme in the Banner example. (via Claude, verify if it makes sense)

Same steps and cause as on iOS.

Web, Banner example with custom theme: white text on light background

(via Claude, verify if it makes sense)

@satya164 satya164 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.

Review by Claude

See the inline comments. (via Claude, verify if it makes sense)

Comment thread src/components/Banner.tsx Resolved
Comment thread src/components/Surface.tsx Resolved
Comment thread src/components/Surface.tsx Resolved
Comment thread src/components/Surface.tsx Resolved
Comment thread docs/6.x/docs/guides/migration.md Resolved
Comment thread docs/6.x/docs/guides/migration.md Resolved
Comment thread docs/6.x/docs/guides/migration.md Resolved
Comment thread example/src/Examples/SurfaceExample.tsx Resolved
@satya164

satya164 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review by Claude

iOS

Surface example, dark theme: the surface and surfaceDim tiles are invisible, also with the elevated tile suggested earlier. (via Claude, verify if it makes sense)

  1. Turn on "Dark Theme" in the drawer.
  2. Open the Surface example and look at the "Semantic container colors" row.

What happens: in DarkTheme, surface and surfaceDim both use neutral6, the same color as the screen. With elevation={1} and mode="elevated" (the earlier suggestion), the shadow does not show on the dark screen, so both tiles still look like plain text.

What should happen: every tile is visible in light and dark theme. A hairline outlineVariant border does this (see the web screenshot below).

iOS, dark theme, elevated tiles: surface and surfaceDim still blend in

Android

Surface example, dark theme: the surface and surfaceDim tiles are invisible. (via Claude, verify if it makes sense)

Same steps and cause as on iOS.

Android, dark theme: surface and surfaceDim tiles blend in

Web

Surface example, dark theme: the surface and surfaceDim tiles are invisible. (via Claude, verify if it makes sense)

Same steps and cause as on iOS.

Web, dark theme: surface and surfaceDim tiles blend in
Web, dark theme, with a hairline outlineVariant border: every tile is visible

(via Claude, verify if it makes sense)

@satya164 satya164 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.

Review by Claude

  • docs/6.x/docs/guides/theming.mdx (line 109) still names menus as an example of surfaces tinted by theme.colors.elevation. With this PR, Menu and Banner take their background from surfaceContainer and surfaceContainerLow, so a reader who changes elevation.level2 to restyle menus sees no effect. Drop "or menus" there, or add that Menu and Banner use the surfaceContainer* roles. (via Claude, verify if it makes sense)

Comment thread src/components/Surface.tsx Resolved
Hristo Totov added 2 commits October 24, 2026 11:43
@hristototov

Copy link
Copy Markdown
Collaborator Author

Review by Claude

  • docs/6.x/docs/guides/theming.mdx (line 109) still names menus as an example of surfaces tinted by theme.colors.elevation. With this PR, Menu and Banner take their background from surfaceContainer and surfaceContainerLow, so a reader who changes elevation.level2 to restyle menus sees no effect. Drop "or menus" there, or add that Menu and Banner use the surfaceContainer* roles. (via Claude, verify if it makes sense)

Updated theming.mdx: the elevation note now names only app bars, and says that menus and banners use the surfaceContainer and surfaceContainerLow roles instead.

@Doberjohn

Copy link
Copy Markdown
Collaborator

Per D6 in #5150, Surface keeps its current API in 6.0 (new API can come in a minor), so could you trim this to the dynamic theme fix?

Once trimmed, it lands first in the Menu chain, before #5122, #5051 and #5073.

@Doberjohn Doberjohn modified the milestones: 6.0.0, 6.0.0-beta.0 Nov 12, 2026
@Doberjohn Doberjohn added the needs pickup Work that has been started but needs someone to pick it up and continue. label Nov 18, 2026
@lukewalczak lukewalczak removed the needs pickup Work that has been started but needs someone to pick it up and continue. label Nov 23, 2026
@lukewalczak lukewalczak self-assigned this Nov 23, 2026
…emantic-container-color

# Conflicts:
#	src/components/__tests__/Banner.test.tsx
#	src/index.tsx
@lukewalczak lukewalczak changed the title feat(theme): add semantic container color prop to Surface fix(menu, banner)!: use surfaceContainer roles for background Nov 23, 2026
@kachmashk kachmashk assigned kachmashk and unassigned kachmashk Nov 23, 2026
BREAKING CHANGE: Menu and Banner backgrounds no longer follow `elevation`. Menu uses `theme.colors.surfaceContainer` and Banner `theme.colors.surfaceContainerLow`; customize those roles or pass `backgroundColor` instead of `theme.colors.elevation.level2` and `level1`.
@lukewalczak

Copy link
Copy Markdown
Member

Per D6 in #5150, Surface keeps its current API in 6.0 (new API can come in a minor), so could you trim this to the dynamic theme fix?

Once trimmed, it lands first in the Menu chain, before #5122, #5051 and #5073.

Done. The PR now has only the dynamic theme fix:

  • Menu passes surfaceContainer and Banner passes surfaceContainerLow through Surface's existing backgroundColor. Both have tests and migration notes.
  • The Surface container prop is gone, and so are SurfaceRole, the Searchbar change, and the Surface example, docs data and tests. Surface is not touched.
  • The description says "Part of Surface: first-class semantic container color API independent of elevation #5119", and the title is fix(menu, banner)!:. The last commit has a BREAKING CHANGE: footer for the squash message.

I also added an optional backgroundColor prop to Banner and Menu, which isn't in your list. In v5, a single banner or menu could get its own background through style.backgroundColor on Banner or contentStyle on Menu. #5078 removed that when Surface stopped reading style, because Banner's style is merged with a Reanimated animated style and can't be flattened. Appbar and Avatar got a backgroundColor prop in exchange, and Banner and Menu didn't. Without the prop, the only way to change their background in 6.0 is the theme role, which changes every banner or menu in the app. The prop forwards to Surface's existing backgroundColor, so Surface's API stays the same and D6 still holds. The migration guide lists it with the other dedicated props, next to Appbar and Avatar.

…emantic-container-color

# Conflicts:
#	src/components/__tests__/Banner.test.tsx

@jacekAtCK jacekAtCK 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.

looks good from the code side :) I've posted some comments below - mostly docs after the merge with main and one test. Nothing blocking

Comment thread docs/6.x/docs/guides/migration.md Resolved
Comment thread docs/6.x/docs/guides/migration.md Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants