angular / angular/components

bug(FormField): Tabbing to then out of form field with "required" validator shows validation error.

Open
#27,625 10 comments 0 reactions 0 assignees View on GitHub
area: material/datepicker area: material/form-field P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

Premature error validation occurs when tabbing from the form field text entry section to the datepicker button. From an A11Y and usability perspective, this should not occur until the user has left the containing form field and button since the datepicker button is a valid way of filling out the form field.

### Reproduction

**StackBlitz link:** https://components-issue-zzukvj.stackblitz.io
**Steps to reproduce:**
1. Add Datepicker to app from angular material code example
2. Add required validator to form control
3. Tab from the form field section to the datepicker button
4. Error shows, despite not having left the control

### Expected Behavior

Required validation does not occur when tabbing from the text entry section of the datepicker to the calendar pop-out button.

It should only occur when tabbing out of the containing form field and button.

### Actual Behavior

Required error validation occurs when tabbing from the text entry section of the datepicker to the open calendar button

### Environment

- Angular: 15.2.4
- CDK/Material: 15.2.5
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS, Windows

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the behavior in the linked StackBlitz using the Angular Material datepicker with a required form control, then inspect the datepicker and form-field implementation. Done means tabbing from the text entry to the calendar button does not show the required error, while leaving both still triggers validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
accessibility, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.