Skip to content
This repository has been archived by the owner on Nov 10, 2018. It is now read-only.

Change checkboxes and radios to validate on click #29

Merged
merged 2 commits into from
Sep 29, 2017

Conversation

robinwhittleton
Copy link
Contributor

This library has made the choice to validate inputs on blur; this is a totally reasonable choice for normal text inputs as it stops potential off-putting switching between validity states as the user types. For radios and checkboxes though there’s no typing to be done, yet the library still waits for a blur event (i.e. a click somewhere else or a tab away) before updating the visual validity state.

This commit adds a click event handler for radios and checkboxes that will evaluate the validity immediately after the browser changes the internal state of the control. This provides immediate feedback to the user that they’ve corrected the problem.

Example without this change (this is particularly bad as it’s using a custom form control that is basing its styling on validate’s state):
A screen capture of the behaviour without this patch

Example with this change:
A screen capture of the behaviour with this patch

robinwhittleton and others added 2 commits September 12, 2017 16:30
This library has made the choice to validate inputs on blur; this is a totally reasonable choice for normal text inputs as it stops potential off-putting switching between validity states as the user types. For radios and checkboxes though there’s no typing to be done, yet the library still waits for a blur event (i.e. a click somewhere else or a tab away) before updating the visual validity state.

This commit adds a click event handler for radios and checkboxes that will evaluate the validity immediately after the browser changes the internal state of the control. This provides immediate feedback to the user that they’ve corrected the problem.
@cferdinandi cferdinandi merged commit de77ab2 into cferdinandi:master Sep 29, 2017
@cferdinandi
Copy link
Owner

Good call. Definitely the way to go. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants