Files
wordpress/wp-includes/comment-template.php
audrasjb 9fd3e4740d Comments: Remove novalidate attribute from comments form by default.
Browser support for client-side validation is now reliable. Blocking the form submission when there is a missing/invalid field prevents the possibility of losing comment content when bfcache does not restore the previous page when going back.

To retain the `novalidate` attribute, the `comment_form()`'s args now accepts a `novalidate` key which will add the attribute when it is `true`. This can also be supplied by the `comment_form_default_fields filter`, for example:

{{{
add_filter( 'comment_form_defaults', function ( $args ) {
    $args['novalidate'] = true;
    return $args;
} );
}}}

Reviewed by audrasjb.
Merges [60304] to the 6.8 branch.

Fixes #47595.
Props westonruter, joedolson, sabernhardt, afercia, SergeyBiryukov, guddu1315, pfefferle, oglekler, bugnumber9.


Built from https://develop.svn.wordpress.org/branches/6.8@60412


git-svn-id: http://core.svn.wordpress.org/branches/6.8@59748 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-07-05 06:53:38 +00:00

101 KiB