[wp-trac] [WordPress Trac] #47595: Re-evaluate whether comment form should still get the HTML5 novalidate attribute

WordPress Trac noreply at wordpress.org
Sat Jul 5 06:51:24 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 fixed-   |  template
  major needs-dev-note dev-reviewed  |
-------------------------------------+-------------------------------------
Changes (by audrasjb):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"60412" 60412]:
 {{{
 #!CommitTicketReference repository="" revision="60412"
 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.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47595#comment:31>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list