components icon indicating copy to clipboard operation
components copied to clipboard

Mat-select in Mat-form-field after closing the panel,the errorState and focused doesn't change.

Open Howard-Song opened this issue 9 years ago • 3 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

using mat-select in mat-form-field like this:

  <mat-form-field>
      <mat-select placeholder="count" formControlName="select" panelClass="select-panel" >
        <mat-option value="1">1</mat-option>
        <mat-option value="2">2</mat-option>
        <mat-option value="3">3</mat-option>
      </mat-select>
  </mat-form-field>

Close the panel then errorState may be update.

What is the current behavior?

when I close the panel,the select is still focused.And I binding validate directive to mat-select after closing the panel,the errorState doesn't change. After close the panel,when I click blank area,the errorState changed.

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

Angular: 4.4.4 Material: 2.0.0-beta.12 OS: win10 TypeScript: 2.3.3 browsers: Chrome v 62.0.3202.75

Is there anything else we should know?

That's all,thanks you for help.

Howard-Song avatar Oct 31 '17 08:10 Howard-Song

This is expected behavior. Focus returns to the <mat-select> just like a native <select>.

The Material spec says that errors should not show until an invalid control has been touched. That doesn't occur until the control is focused and subsequently blurred. That's why it requires you to click in a blank area before the error is visible.

If you wish, this behavior is customizable via the errorStateMatcher input or by providing a different ErrorStateMatcher in the DI tree.

willshowell avatar Oct 31 '17 14:10 willshowell

Closing as this is working as intended as explained in @willshowell's comment

josephperrott avatar Oct 31 '17 16:10 josephperrott

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.