Skip to content

bug(tabs): Background color not applied for M2 theme #31343

Closed
@ChristofferGersen

Description

@ChristofferGersen

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

19.2.2

Description

The backgroundColor does not work anymore. This is caused by the --mat-tab-background-color and --mat-tab-foreground-color CSS variables being undefined. They are undefined, because commit 7b5d88b introduced a few typo's in ‎src/material/tabs/_tabs-theme.scss. The map.get($tokens, background-color) and map.get($tokens, foreground-color) inside the color mixin are missing the tab- prefix.

On a side note, the backgroundColor input is only deprecated for MatTabGroup, but not for MatTabNav, is that correct?

Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-starter-bfy7wqwd?file=src%2Fmain.ts
Steps to reproduce:

  1. No colors are applied after load

Expected Behavior

The tabs should have a background color.

Actual Behavior

No background color.

Environment

  • Angular: 20.0.2
  • CDK/Material: 20.0.3
  • Browser(s): Chrome 137.0.7151.70
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions