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

[mat-slider] slider is visually focused when parent is focused and uses cdkMonitorSubtreeFocus directive #14958

Closed
jpnickolas opened this issue Jan 25, 2019 · 1 comment · Fixed by #14960
Assignees
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@jpnickolas
Copy link

mat-slider will be styled as if focused if a parent element to the slider has its focus being monitored with something like the cdkMonitorSubtreeFocus directive.

What is the expected behavior?

Focusing an element on a page should not cause an unrelated mat-slider to become focused.

What is the current behavior?

If a parent element to the mat-slider has the focus of it and its children being monitored, it will also cause mat-slider to be focused when the parent is keyboard focused.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-material2-issue-ykmdsb

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Material Version: 7.0.2

Is there anything else we should know?

I believe this is being caused by the following css rule:
https://github.com/angular/material2/blob/master/src/lib/slider/slider.scss#L97

It specifies that any parent of .mat-slider-focus-ring with the .cdk-keyboard-focused or .cdk-program-focused class should apply the focus styles to .mat-slider-focus-ring.

I believe specifying that the .cdk-*-focused selectors should apply only to a .mat-slider parent should be enough to fix this issue.

@crisbeto crisbeto self-assigned this Jan 25, 2019
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent has pr labels Jan 25, 2019
crisbeto added a commit to crisbeto/material2 that referenced this issue Jan 25, 2019
Fixes an overly-broad selector that meant that the slider's focus ring would show if any of its ancestors has focus monitoring.

Fixes angular#14958.
mmalerba pushed a commit that referenced this issue Jan 30, 2019
…14960)

Fixes an overly-broad selector that meant that the slider's focus ring would show if any of its ancestors has focus monitoring.

Fixes #14958.
mmalerba pushed a commit that referenced this issue Feb 4, 2019
…14960)

Fixes an overly-broad selector that meant that the slider's focus ring would show if any of its ancestors has focus monitoring.

Fixes #14958.
@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 Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants