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

fix(material/radio): hidden circle visible on some zoom levels #22066

Merged

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Mar 1, 2021

We transition the circle of a radio button to scale(0.001) in order to hide it and to work around an animation in IE. It seems that on higher system zoom levels (e.g. 125%+) the browser approximates the size to 1x1 which can be visible.

These changes work around the issue by also setting opacity: 0 while the circle is inactive and isn't animating.

Fixes #22036.

We transition the circle of a radio button to `scale(0.001)` in order to hide it and to work
around an animation in IE. It seems that on higher system zoom levels (e.g. 125%+) the
browser approximates the size to 1x1 which can be visible.

These changes work around the issue by also setting `opacity: 0` while the circle is inactive
and isn't animating.

Fixes angular#22036.
@crisbeto crisbeto added 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 labels Mar 1, 2021
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Mar 1, 2021
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

// dot (see #22036). Ensure that it's hidden using `opacity`. There's a slight transition with
// a long delay so that switching the opacity only applies after the `transform` is done.
opacity: 0;
transition: $base-transition, opacity linear 1ms $transition-duration;
Copy link
Contributor

Choose a reason for hiding this comment

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

why does it have a duration and a delay, isn't just a delay good enough?

Copy link
Member Author

Choose a reason for hiding this comment

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

If it just left it in as opacity linear $transition-duration it won't delay at all and I think that some browsers won't animate it if it's 0ms.

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Mar 1, 2021
// On some zoom levels the `scale(0.001)` from below can cause the circle to be shown as a 1x1
// dot (see #22036). Ensure that it's hidden using `opacity`. There's a slight transition with
// a long delay so that switching the opacity only applies after the `transform` is done.
opacity: 0;
Copy link
Member

Choose a reason for hiding this comment

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

I believe JAWS + IE11 treats opacity: 0 as hidden, unfortunately.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is just a blank span, the input is a sibling element.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@wagnermaciel
Copy link
Contributor

@crisbeto This breaks a handful of screenshot tests internally. I don't know if you'd be able to debug this with just these screenshots, so if not we'll need to have the next caretaker take a closer look

Before:
Screen Shot 2021-03-02 at 11 41 02 AM

After:
Screen Shot 2021-03-02 at 11 41 11 AM

@wagnermaciel wagnermaciel merged commit ae968ab into angular:master Jul 12, 2021
wagnermaciel pushed a commit that referenced this pull request Jul 12, 2021
We transition the circle of a radio button to `scale(0.001)` in order to hide it and to work
around an animation in IE. It seems that on higher system zoom levels (e.g. 125%+) the
browser approximates the size to 1x1 which can be visible.

These changes work around the issue by also setting `opacity: 0` while the circle is inactive
and isn't animating.

Fixes #22036.

(cherry picked from commit ae968ab)
wagnermaciel added a commit that referenced this pull request Jul 12, 2021
wagnermaciel added a commit to wagnermaciel/components that referenced this pull request Jul 16, 2021
@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 Aug 12, 2021
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.

bug(checkbox): A small dot in the middle of an inactive radio button
4 participants