[wp-trac] [WordPress Trac] #47595: Re-evaluate whether comment form should still get the HTML5 novalidate attribute
WordPress Trac
noreply at wordpress.org
Thu Jun 12 20:45:59 UTC 2025
#47595: Re-evaluate whether comment form should still get the HTML5 novalidate
attribute
-------------------------------------+-------------------------------------
Reporter: westonruter | Owner: westonruter
Type: enhancement | Status: closed
Priority: normal | Milestone: 6.8.2
Component: Comments | Version: 3.6
Severity: normal | Resolution: fixed
Keywords: has-patch input- | Focuses: ui, accessibility,
validation has-unit-tests | template
-------------------------------------+-------------------------------------
Changes (by westonruter):
* status: accepted => closed
* resolution: => fixed
Comment:
In [changeset:"60304" 60304]:
{{{
#!CommitTicketReference repository="" revision="60304"
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:
{{{#!php
add_filter( 'comment_form_defaults', function ( $args ) {
$args['novalidate'] = true;
return $args;
} );
}}}
Fixes #47595.
Props westonruter, joedolson, sabernhardt, afercia, SergeyBiryukov,
guddu1315, pfefferle, oglekler, bugnumber9.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47595#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list