Skip to content

MatSelectionList accent color not correctly applied when inside tabs #16891

Description

@benelliott

Reproduction

https://stackblitz.com/edit/components-issue-u8tctx

Expected Behavior

Selection list checkboxes should default to accent regardless of their parent.

Actual Behavior

Selection list checkboxes get stuck on primary even when accent is explicitly specified, when inside components that do apply a theme class, such as tabs.

This is because MatSelectionList doesn't apply a specific theme when accent is set:

'[class.mat-primary]': 'color === "primary"',

However, this fails when the selection list is inside tabs as those tabs do have a mat-primary theme set on them which overrides this default behaviour.

Here is the theme logic inside pseudo-checkbox:

This could be fixed by explicitly setting the default accent class on the selection list when none is specified (or accent is explicitly specified).

Environment

Latest StackBlitz

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions