Skip to content

bug(focus indicators): Focus indicators are now positioned. - #19345

Merged
jelbourn merged 2 commits into
angular:masterfrom
zelliott:relative
Jun 5, 2020
Merged

jelbourn merged 2 commits into
angular:masterfrom
zelliott:relative

Conversation

@zelliott

Copy link
Copy Markdown
Contributor
  • Just as every .mat-ripple is positioned in order to create an easy API for developers, every .mat-focus-indicator should be positioned. This way, when developers add the class .mat-focus-indicator to their own custom focusable elements they do not also need to position the element.
  • As a result of positioning every .mat-focus-indicator, a few components that set position: absolute on the associated element need to have their specificity bumped.
  • In testing this change, I fixed a few bugs as a result of fix(datepicker): strong focus indication in calendar always shown #19304 (comments inline).
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 13, 2020

@crisbeto crisbeto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but @jelbourn might have an opinion on this.

@zelliott

Copy link
Copy Markdown
Contributor Author

@jelbourn Before merging this, let's close on whether the style .mat-focus-indicator { position: relative; } should be within mat-strong-focus-indicators or mat-core. See the associated comment on the PR.

@jelbourn jelbourn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Replied via email, but I'm good with adding the relative style in mat-core (assuming the TGP works out)

@zelliott
zelliott requested a review from devversion as a code owner May 13, 2020 18:53
Comment thread src/dev-app/theme.scss Resolved
@zelliott
zelliott requested a review from jelbourn May 13, 2020 18:59

// The focus indicator should match the bounds of the entire button.
.mat-mdc-focus-indicator {
@include mat-fill();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Before this change, this element had essentially no styles, and thus the focus indicator actually rendered relative to the parent button. Now that we've added position: relative to this element, the fact that it has no styles is problematic (the focus indicator doesn't render with the correct bounding box). Consequently, use mat-fill to make this element match the bounds of the entire button.

@zelliott

Copy link
Copy Markdown
Contributor Author

TGP LGTM, sent the link to you @jelbourn.

@jelbourn jelbourn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, just minor naming comment

@jelbourn jelbourn added lgtm target: patch This PR is targeted for the next patch release labels May 15, 2020
@zelliott

Copy link
Copy Markdown
Contributor Author

Addressed naming comment, rebased and squashed commits.

@jelbourn jelbourn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added action: merge The PR is ready for merge by the caretaker merge: fix commit message When the PR is merged, rewrites/fixups of the commit messages are needed and removed needs rebase labels May 18, 2020
…lesheets are ordered improperly in Karma unit tests.
@zelliott
zelliott requested a review from jelbourn June 4, 2020 18:08
@jelbourn jelbourn added target: major This PR is targeted for the next major release and removed target: patch This PR is targeted for the next patch release labels Jun 5, 2020
@jelbourn
jelbourn merged commit c05a07e into angular:master Jun 5, 2020
@angular-automatic-lock-bot

Copy link
Copy Markdown

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 6, 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 merge: fix commit message When the PR is merged, rewrites/fixups of the commit messages are needed target: major This PR is targeted for the next major release

4 participants