[wp-trac] [WordPress Trac] #56798: Twenty Twenty-Two: Post comments block accessibility fixes
WordPress Trac
noreply at wordpress.org
Tue Oct 11 17:37:40 UTC 2022
#56798: Twenty Twenty-Two: Post comments block accessibility fixes
---------------------------+--------------------
Reporter: desrosj | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.1.1
Component: Bundled Theme | Version:
Severity: normal | Keywords:
Focuses: accessibility |
---------------------------+--------------------
From https://github.com/WordPress/wordpress-develop/pull/3136:
> The Post Comments block uses an h3 heading on it, this causes a11y
issues [as discussed in #43203 (and previously
https://core.trac.wordpress.org/ticket/55172 )] on the templates where
it's inserted, since there are no existing h2 in them. The new Comments
block doesn't have the same problem because it allows you to change the
heading as you need, but it's only available with Gutenberg or WP >= 6.1.
To solve this issue, we are doing the following:
>
> - We are creating a hidden block pattern that inserts either of the
blocks depending on if the new block is registered and the WP version is
>= 6.1
> - For users that will get the deprecated version of the block, we are
using the `render_block` hook to swap the h3 with an h2, and solve the
a11y for them
> - Users that will get the newer version of the block, will have the h2
instead.
>
> To test this:
> - Run this branch, check a page with comments on it, you should be
seeing the headings using h2. On the editor, you should be seeing the new
Comments block (there is no deprecation message present). You may need to
tweak this line in `hidden-comments.php`, since this branch is still not a
6.1 version of WP:
>
> `if ( WP_Block_Type_Registry::get_instance()->is_registered(
'core/comments' ) && version_compare( $GLOBALS['wp_version'], '6.1', '>='
) ) {`
>
> - Run the code from this branch on a 6.0 environment, you should be
seeing the old block, with the deprecation notice in the editor. In the
frontend, you should still see the headings on the comments block using
h2, instead of h3.
>
> Aside from a11y, note that this PR also improves User Experience of the
TT2 theme: Users with WP >= 6.1 will get the Comments block in editable
mode automatically, rather than seeing the legacy mode and the upgrade
notice.
This was raised in #55172, but deemed not a blocker to adding the
Accessibility Ready tag. Props to @poena when merged for raising this
issue.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56798>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list