Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(mat-slider): when mat-slider has parent with .mat-accent it will not show the primary color #21271

Closed
andreElrico opened this issue Dec 10, 2020 · 4 comments · Fixed by #21334
Assignees
Labels
area: material/slider Fixed in MDC P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@andreElrico
Copy link

Reproduction

Steps to reproduce:

https://stackblitz.com/edit/angular-ma9v9u?file=src%2Fapp%2Flist-single-selection-example.html

Expected Behavior

mat-slider with color=primary should display primary color, nomatter where its used.

Actual Behavior

If parent has class mat-accent it will make the slider accent color.

Solution

The solution is obvious:

this here wins over mat-primary ... Im asking if other components are programmed in this same "general selector fashion"

Environment

latest stackblitz from docs (see date of this post)

@andreElrico andreElrico added the needs triage This issue needs to be triaged by the team label Dec 10, 2020
@jelbourn
Copy link
Member

While I agree that this is kind of weird, I don't think we will do anything to change it. It's somewhat unexpected to put a slider inside of another form control that supports the color input. In particular, putting a slider into a selection list or chip would be invalid from an accessibility perspective.

@crisbeto
Copy link
Member

This can happen if a slider is put inside a tab group with an explicit color. Reopening.

@crisbeto crisbeto reopened this Dec 10, 2020
@crisbeto crisbeto added area: material/slider P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Dec 10, 2020
@andreElrico
Copy link
Author

Thank you @crisbeto, I can confirm, it will happen with a tab with color accent. It will also happen with a slider inside a toolbar.
It seems NOT to happen with vert./hor. stepper.

@crisbeto crisbeto self-assigned this Dec 12, 2020
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 12, 2020
… component with theme

The slider theme selectors were a bit too broad which meant that it
would automatically inherit the colors from a parent component,
if the Material theming classes were used somewhere up the chain
(e.g. a slider inside a tab group).

These changes use more specific selectors to avoid the issue.

Fixes angular#21271.
crisbeto added a commit to crisbeto/material2 that referenced this issue Dec 21, 2020
… component with theme

The slider theme selectors were a bit too broad which meant that it
would automatically inherit the colors from a parent component,
if the Material theming classes were used somewhere up the chain
(e.g. a slider inside a tab group).

These changes use more specific selectors to avoid the issue.

Fixes angular#21271.
crisbeto added a commit to crisbeto/material2 that referenced this issue Apr 25, 2021
… component with theme

The slider theme selectors were a bit too broad which meant that it
would automatically inherit the colors from a parent component,
if the Material theming classes were used somewhere up the chain
(e.g. a slider inside a tab group).

These changes use more specific selectors to avoid the issue.

Fixes angular#21271.
andrewseguin pushed a commit that referenced this issue Jan 15, 2022
… component with theme (#21334)

The slider theme selectors were a bit too broad which meant that it
would automatically inherit the colors from a parent component,
if the Material theming classes were used somewhere up the chain
(e.g. a slider inside a tab group).

These changes use more specific selectors to avoid the issue.

Fixes #21271.
andrewseguin pushed a commit that referenced this issue Jan 15, 2022
… component with theme (#21334)

The slider theme selectors were a bit too broad which meant that it
would automatically inherit the colors from a parent component,
if the Material theming classes were used somewhere up the chain
(e.g. a slider inside a tab group).

These changes use more specific selectors to avoid the issue.

Fixes #21271.

(cherry picked from commit b851456)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 15, 2022
forsti0506 pushed a commit to forsti0506/components that referenced this issue Apr 3, 2022
… component with theme (angular#21334)

The slider theme selectors were a bit too broad which meant that it
would automatically inherit the colors from a parent component,
if the Material theming classes were used somewhere up the chain
(e.g. a slider inside a tab group).

These changes use more specific selectors to avoid the issue.

Fixes angular#21271.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/slider Fixed in MDC P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
3 participants