1. Drupal 8.2.3
  2. Create a new Contact Form: /admin/structure/contact/add
  3. Include required fields in your new form
  4. Activate Page Load Progress for your new form: /admin/config/user-interface/page-load-progress
  5. Navigate to your new from -- but do not enter any data into the required fields -- and then press the form's "Send Message" button
  6. The Page Load Progress will activate and the user will not be able to see the required fields error message, nor will the user be able to enter data into the required fields and then resubmit the form

In my opinion, the Page Load Progress throbber should not activate until after the form has passed validation, otherwise, the user experience is pretty much destroyed.

Comments

Q2U created an issue. See original summary.

anavarre’s picture

Title: PLP doesn't respect form validation » page_load_progress doesn't respect form validation
Version: 8.x-1.1 » 8.x-1.x-dev

Thanks, confirmed. For site admins, it's possible to kill the throbber by pressing the ESC key, but end users wouldn't know and would simply be stuck.

As a workaround, you can decide to exclude page_load_progress from being triggered on the page causing the issue. You can do so from within the visibility conditions section under /admin/config/user-interface/page-load-progress - E.g. by adding /contact/contact_us if that was the relative path to your custom contact form. Do not forget the prefixing slash.

Q2U’s picture

Thank you. Unfortunately the nodes on which I need Page Load Progress to function are the same nodes on which this validation issue manifests. Drat. Page Load Progress is, in my opinion, a blessing for the user experience...but this issue on these specific pages means I can't run PLP. Have you determined -- or do you have an opinion -- as to whether (or not) you will fix this validation issue?

Thanks again...good idea and good module.

anavarre’s picture

Have you determined -- or do you have an opinion -- as to whether (or not) you will fix this validation issue?

Haven't yet, as I need to dive into the JS validation issue first. Definitely something I'm willing to fix one way or another. Stay tuned.

anavarre’s picture

So, we sat down with Dom. to discuss the issue and here's what's happening:

  • The form validation is coming from the browser via HTML5
  • If we were to change the JS to check the parent form, this would need adding an external library (most likely jQuery Validation). Not really an option, is it?
  • One good option we have is to check on form submit only and thus not give the flexibility to have page_load_progress be triggered on any arbitrary CSS class or ID
  • On the plus side, this would make things much simpler. We have yet to see a valid use case making use of anything different than .form-submit for page_load_progress

Here's a sample implementation:

// Add the screen lock behavior for each configured element.
for (var i in exit_elements) {
  var form = $(exit_elements[i]).parents('form');
  form.submit(function () {
    setTimeout(lockScreen, delay);
  });
}
Q2U’s picture

Any progress on this issue?

anavarre’s picture

So, we think the best path forward is likely to restrict the module to .form-submit only. The reason is it's very low-level and if you want to override it you really, really have to put efforts into not using it. Also, allowing any CSS class or ID might be us over-engineering the real-life use cases people actually have. We'd rather keep things simple for 99% of our user base and explore edge cases on a case-by-case basis.

So we'll proceed with this plan. This will quite significantly reduce the module complexity.

anavarre’s picture

anavarre’s picture

Status: Active » Fixed

The patch in #2883036: Explore supporting only .form-submit or add a new class should fix the issue since we've now changed the JS behavior to account for HTML 5 validation. Please follow the other issue. It'll soon be committed to dev and I'll tag a new release next.

anavarre’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.