bug(optgroup): Overriding label-text-color has no effect #30081
Labels
area: material/core
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Using Angular and Material v19, I am trying to change the optgroup text color using the new
mat.optgroup-overrides
withlabel-text-color
token mixins documented here but it has no effect.Reproduction
My scss file:
and html:
But it has no effect, the color stays to its default value
--mat-sys-on-surface
.Inspecting CSS
I can see the red color being applied to the
mat-optgroup
host element.But it is overriden in the inner child that contains the text:
<span class="mdc-list-item__primary-text">Category 1</span>
which has the following CSS:Workaround
You could use
mat.list-overrides
but it will affect every list not just optgroup so I'm overriding the list CSS variable only for optgroups.After that it works fine:
Expected Behavior
Optgroup text should be red.
Actual Behavior
Optgroup text stays grey.
Environment
The text was updated successfully, but these errors were encountered: