Skip to content

fix(select): don't blur label when trigger is blurred while the panel is opened #11537

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
merged 1 commit into from
Jun 20, 2018

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented May 27, 2018

Considers a select as focused as long as its panel is open, even if the trigger loses focus. This avoids cases where the label can be seen blinking in the background when an option is toggled in multi-select mode.

For reference:
demo

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 27, 2018
@mmalerba mmalerba added pr: lgtm action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels May 29, 2018
@@ -299,7 +299,10 @@ export class MatSelect extends _MatSelectMixinBase implements AfterContentInit,
private _disableOptionCentering: boolean = false;

/** Whether the select is focused. */
focused: boolean = false;
get focused(): boolean {
Copy link
Member

Choose a reason for hiding this comment

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

A setter needs to be defined here as well.

With this change, the API is changed as focused becomes readonly.

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 didn’t add a setter, because the MatFormFieldControl interface calls for the property to be readonly. That being said, it doesn’t look like TS actually enforces it.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm okay, Lets add the setter as deprecated and then we can move it to readonly later

@josephperrott josephperrott removed pr: lgtm action: merge The PR is ready for merge by the caretaker labels May 31, 2018
… is opened

Considers a select as focused as long as a its panel is open, even if the trigger loses focus. This avoids cases where the label can be seen blinking in the background when an option is toggled in multi-select mode.
@crisbeto crisbeto force-pushed the select-toggle-focused branch from 6cf8081 to 742fb85 Compare May 31, 2018 18:16
@crisbeto crisbeto added pr: lgtm action: merge The PR is ready for merge by the caretaker labels May 31, 2018
@crisbeto
Copy link
Member Author

Setter has been added.

@mmalerba
Copy link
Contributor

mmalerba commented Jun 1, 2018

@crisbeto looks like there are some CI issues

@crisbeto
Copy link
Member Author

crisbeto commented Jun 1, 2018

Seems like a flake. I’ve restarted it.

@tinayuangao tinayuangao merged commit 83631fc into angular:master Jun 20, 2018
tinayuangao pushed a commit that referenced this pull request Jun 20, 2018
… is opened (#11537)

Considers a select as focused as long as a its panel is open, even if the trigger loses focus. This avoids cases where the label can be seen blinking in the background when an option is toggled in multi-select mode.
victoriaaa234 pushed a commit that referenced this pull request Jul 25, 2018
… is opened (#11537)

Considers a select as focused as long as a its panel is open, even if the trigger loses focus. This avoids cases where the label can be seen blinking in the background when an option is toggled in multi-select mode.
@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 9, 2019
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 target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants