Skip to content
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

Clearing a date field leaves it marked invalid in Chrome 83 #1153

Closed
pauln opened this issue Jun 5, 2020 · 0 comments · Fixed by #1154
Closed

Clearing a date field leaves it marked invalid in Chrome 83 #1153

pauln opened this issue Jun 5, 2020 · 0 comments · Fixed by #1154

Comments

@pauln
Copy link
Contributor

pauln commented Jun 5, 2020

As of Chrome 83, where input fields were redesigned for visual consistency, the date input no longer has a "clear" button (x). This means that the only way to clear a date once entered is to individually select and backspace/delete each component (day, month and year).

Although a nuisance, that wouldn't be quite such a problem - but Chrome doesn't (and already didn't) fire the oninput event when the second and third date components are cleared, only when the first is cleared. When the first component is cleared, inputElement.validity.badInput is true - so the field is marked as invalid... but since there are no subsequent oninput events, it never gets marked as valid again.

pauln added a commit to pauln/ember-paper that referenced this issue Jun 5, 2020
Chrome 83 has removed the clear button from date inputs, which means that there's now no way to clear a date field and have its validity state correctly updated.  Since the `oninput` event fired when the first date component is cleared provides an empty string as the new value, we can detect this and override `validity.badInput` to immediately update our validity state in order to avoid leaving the field permanently flagged as invalid.

Fixes adopted-ember-addons#1153
miguelcobain pushed a commit that referenced this issue Jun 12, 2020
Chrome 83 has removed the clear button from date inputs, which means that there's now no way to clear a date field and have its validity state correctly updated.  Since the `oninput` event fired when the first date component is cleared provides an empty string as the new value, we can detect this and override `validity.badInput` to immediately update our validity state in order to avoid leaving the field permanently flagged as invalid.

Fixes #1153
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant