Skip to content

mat-select with validation not kicked when focus is lost #8573

Closed
@k-krupka

Description

@k-krupka

Bug, feature request, or proposal:

In my opinion bug with mat-select. The error message is not visible when dropdown is closed; focus is not behaving properly with "required" attribute applied.

What is the expected behavior?

When focus is not on the control anymore, the error message should be visible.

What is the current behavior?

When focus is lost, the error message is not immediately visible.

What are the steps to reproduce?

  1. http://plnkr.co/edit/K6hyF9?p=preview
  2. Click on "favorite options" on the left hand side
  3. Click out of dropdown to cancel the selection
  4. Notice the visible "this field is required message"
  5. Click on "favorite food"
    image
    image
  6. click out of dropdown to cancel the selection
  7. notice that "this field is required" is not visible + the bottom line thickness is a little bit bigger than standard
    image
  8. click again outside of the control, to remove focus on the control
  9. the "this field is required" message is visible now
    image

What is the use-case or motivation for changing an existing behavior?

As on the plunker shown, autocomplete is behaving move intuitevly when deselecting / closing the dropdown. Validation occurs immediatelly as you would expect it. With mat-select it's not. In order to kick off the validation, you need to click twice somewhere on the form (some sort).

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

material: 5.0.0-rc.1-6a9fbfe
angular: as for version above
OS: win 10 64bit enterprise
browser: all

Is there anything else we should know?

nope, keep up the good work over this repository :)

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions