Add support for focusInvalid()

Drupal issue

https://www.drupal.org/project/clientside_validation/issues/3162213

Overview

This MR addresses an issue when there are required fields in a webform that uses clientside_validation and the webform is set to use Ajax. In this case, on submit or "next" in the case of a webform wizard, the form does not jump backup to the first required field that was not filled in. On simple short forms this may not be an issue but on large forms where a given required field might no longer be in the viewport, this presents a UX issue.

Proposed fix with this MR

Implement validator.focusInvalid(); with no UI setting so that it just works for Ajax and non-Ajax forms.

Closes #3162213

Edited by Danny Englander

Merge request reports

Loading