Change record status: 
Project: 
Introduced in branch: 
11.4.x
Introduced in version: 
11.4.0
Description: 

A new setting for controlling HTML5 validation, enable_html5_validation, is added to the settings.php file.

This allows sites to decide if the wish to use client-side HTML validation or not. Using client-side HTML5 validation (e.g., required, pattern), can cause accessibility and user experience issues. On form submit with missing or invalid input, the browser will display its own validation messages and prevent the Drupal's Form API (FAPI) validation from executing. Thus, Drupal error messages are not displayed.

The results in a poor user experience, especially for those relying on screen readers, keyboard navigation, or translated interfaces. Native browser error messages cannot be customized, styled, or localized, and only appear for one field at a time.

In Drupal 11 this setting defaults to TRUE and HTML5 validation is enabled which retains the existing behavior.

In Drupal 12 this setting defaults to FALSE and HTML5 validation is disabled.

In Drupal 13 this setting is scheduled to be removed.

To change the default behavior

Drupal 11

Sites that want to disable HTML5 validation can do so by setting 'enable_html5_validation' to FALSE in settings.php.

$settings['enable_html5_validation'] = FALSE;

Drupal 12

Sites that want to enable HTML5 validation can do so by setting 'enable_html5_validation' to TRUE in settings.php.

$settings['enable_html5_validation'] = TRUE;

Note: Drupal has a feature for making a form field required using JavaScript. For these fields with HMTL5 validation disabled, it is possible to submit a form even when they are empty. For more information, see #3592742: States API required fields don't work without HTML5 validation.

Impacts: 
Site builders, administrators, editors
Module developers
Themers
Site templates, recipes and distribution developers