verbb / formie

The most user-friendly forms plugin for Craft CMS.
Other
93 stars 68 forks source link

Validate on typing fires when being disabled #1913

Closed sword3d closed 1 week ago

sword3d commented 2 weeks ago

Describe the bug

When we submit a form with an error, Typing validation are triggered after submitting it, causing aria-describedby attribute to update instantly on typing. Because of this, we get accessibility issues for voice over. I don't see such problem for the Formie 2.x version.

Steps to reproduce

  1. Enable Validate Form on Submit
  2. Disable Validate When Typing
  3. Submit a form on the frontend
  4. Try to fill-in some field, for example, email input. This will instantly validate your input, which may be fine, but it will also update the aria-describedby each time you press a key.

Form settings

Craft CMS version

5.1.8

Plugin version

3.0.0-beta.14

Multi-site?

yes

Additional context

image

https://github.com/verbb/formie/assets/4801308/233cff1e-ca0a-44da-9c1e-60150c4ba807

engram-design commented 2 weeks ago

This is indeed new behaviour in Formie 3 due to our revised client-side validation.

The goal here is to provide proper feedback when errors are rectified. So when you submit the form initially, the error is flagged (no email provided, or not a valid email), and in Formie 2, after changing the field value, the error message didn't update until after you submitted it again. In Formie 3, we wanted to update that as you modify the field and fix your error as you type. This is a very popular and prevalent UX pattern.

So you're right in that after submission (and an error occurs) the validator turns into a "live" validator.

Having said that, the aria attributes shouldn't change their identifier on type. Fixed for the next release. To get this early, run composer require verbb/formie:"dev-craft-5 as 3.0.0-beta.14".

But I did want to confirm the actual issue here. Is the issue that the aria-describedby reference is changing, or that fact that it's being removed and re-applied as you type? If it's the latter, that's a little unavoidable as the live nature of validation is that it's going to remove the error on-type. If it's the former issue, that's fixed in the above dev branch.

engram-design commented 1 week ago

Fixed in 3.0.0-beta.15