[wp-trac] [WordPress Trac] #47595: Re-evaluate whether comment form should still get the HTML5 novalidate attribute
WordPress Trac
noreply at wordpress.org
Thu May 22 05:19:38 UTC 2025
#47595: Re-evaluate whether comment form should still get the HTML5 novalidate
attribute
-------------------------------------+-------------------------------------
Reporter: westonruter | Owner: joedolson
Type: enhancement | Status: accepted
Priority: normal | Milestone: 6.8.2
Component: Comments | Version: 3.6
Severity: normal | Resolution:
Keywords: has-patch input- | Focuses: ui, accessibility,
validation needs-refresh | template
-------------------------------------+-------------------------------------
Changes (by westonruter):
* milestone: 6.9 => 6.8.2
Comment:
Replying to [comment:20 sabernhardt]:
> However, is there any benefit in creating a filter or argument to allow
//adding// `novalidate` (and/or another attribute) to the `form` element?
With a tweak to my latest patch, I think this would already be the case
given my latest patch, wouldn't it? My latest patch adds `novalidate_form`
key to the `$args` which gets filtered by `comment_form_defaults`. By
default it is added if the theme supports `html5`. Now, however, it should
be just `false` by default, regardless of whether the theme supports
`html5`.
If someone wanted to preserve the `novalidate` attribute, they could just
do:
{{{#!php
<?php
add_filter( 'comment_form_defaults', function ( $args ) {
$args['novalidate_form'] = true;
return $args;
} );
}}}
If that sounds good to you, I'll refresh the patch and move to commit.
This could then be shipped as part of the 6.8.2 milestone as a tiny
enhancement.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47595#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list