Skip to content

fix(material-experimental): strong focus indicator clipped in checkbox and radio button #19423

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

Merged

Conversation

crisbeto
Copy link
Member

In order to support density scaling, the MDC checkbox and radio button have border-radius: 50% on their ripple element which is also used as the strong focus indicator. Since the indicator is a square, it'll be clipped, unless we also make it into a circle.

For reference, here's what the circular indicators look like:
Angular_Material_-_Google_Chrome_2020-05-22_17-41-26
Angular_Material_-_Google_Chrome_2020-05-22_17-43-54

cc @zelliott

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent merge safe target: patch This PR is targeted for the next patch release labels May 22, 2020
@crisbeto crisbeto requested a review from mmalerba as a code owner May 22, 2020 15:49
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 22, 2020
@zelliott zelliott self-requested a review May 22, 2020 17:02
@@ -58,6 +58,15 @@
margin: 5px;
}

// These components have to set `border-radius: 50%` in order to support density scaling
// which will clip a square focus indicator so we have to turn it into a circle.
.mat-mdc-radio-button,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I noticed this as well. Regardless of the clipping, it looks better to render circular focus indicators on these controls. I'd go a step further and say we should render circular focus indicators on all components with circular ripples (i.e. mat-icon-button, mat-checkbox, mat-radio-button, mat-slide-toggle, date picker cells, etc) instead of just spot-fixing these two components. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the circular indicators look better, but I kind of like that the rectangular ones mimic the native browser focus outline. I don't feel strongly about it though.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delayed response on this. I agree that it's nice that the rectangular ones somewhat match Chrome's default focus ring.

I still think the strong focus indicators should either be completely component-agnostic (and thus rectangular on every component), or match the shape of the component. It feels half-baked to have focus indicators circular on two components to work around some technical issues. Curious what @jelbourn thinks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Zack, I think if we're going to start making some of the indicators circular, we should just do it for all of the circular-ripple components

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no strong opinion; as long as they don't look broken it's fine with me

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with merging this PR to fix the ones that look broken and just filing an issue to deal with the other ones that should be circular

…x and radio button

In order to support density scaling, the MDC checkbox and radio button have `border-radius: 50%` on their ripple element which is also used as the strong focus indicator. Since the indicator is a square, it'll be clipped, unless we also make it into a circle.
@crisbeto crisbeto force-pushed the mdc-radio-checkbox-strong-focus branch from 7504116 to 02e6fb4 Compare May 22, 2020 17:43
@mmalerba mmalerba added the lgtm label Jun 9, 2020
Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zelliott
Copy link
Collaborator

zelliott commented Jun 9, 2020

LGTM

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Jun 10, 2020
@andrewseguin andrewseguin merged commit 45492b6 into angular:master Jun 12, 2020
andrewseguin pushed a commit that referenced this pull request Jun 12, 2020
…x and radio button (#19423)

In order to support density scaling, the MDC checkbox and radio button have `border-radius: 50%` on their ripple element which is also used as the strong focus indicator. Since the indicator is a square, it'll be clipped, unless we also make it into a circle.
@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 Jul 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants