Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#61956 closed defect (bug) (wontfix)

Convert div to main tag for web accessibility

Reported by: upendmca Owned by:
Priority: normal Milestone:
Component: Themes Version:
Severity: normal Keywords: has-patch reporter-feedback close
Cc: Focuses: accessibility

Description (last modified by sabernhardt)

How to convert <div class="wp-site-blocks">Content</div> to <main class="wp-site-blocks">Content</main> in gutenberg block template.
This is coming from wp-includes folder block-template.php.

Change History (9)

#1 @sabernhardt
2 years ago

  • Component GeneralThemes
  • Description modified (diff)
  • Focuses accessibility added

This ticket was mentioned in PR #7274 on WordPress/wordpress-develop by @narenin.


2 years ago
#2

  • Keywords has-patch added

#3 @upendmca
2 years ago

  • Keywords has-testing-info added

Hi @narenin

I have tested the patch and it is working fine.

Test Report

Environment:

OS: Windows
PHP: 8.2.12
WordPress: 6.6.1
Browser: Chrome
Theme: Twenty Twenty-One (Version: 2.3)
Plugins: None activated

Actual Results:

✅ Patch working well as desired solution.

#4 @sabernhardt
2 years ago

  • Keywords reporter-feedback added; has-testing-info removed

Hi and welcome to WordPress Core Trac!

Could you explain how you want to use the wp-site-blocks wrapper?

Twenty Twenty-One:

  • is not a block-based theme, so it does not output a wp-site-blocks wrapper
  • already has a <main> element

A document must only have one main element (unless additional main elements are hidden). MDN docs

Related: GB35354

@narenin commented on PR #7274:


2 years ago
#5

@mukeshpanchal27 Thanks for the feedback, I have implemented them, please check.

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


2 years ago

#7 @joedolson
2 years ago

  • Keywords close added

At this time, this change seems unnecessary. I think that the use case would be if you were attempting to child theme a parent that did not use the main element in its templates. In that case, you could use this filter to change the outer wrapper instead of editing the templates in your child theme.

However, block themes in the theme repository are expected to include a main element; the main element is available on relevant blocks as a selectable HTML element in the advanced block settings; and you can change them in child themes (even if it's kind of a pain.)

I think this is probably a wontfix issue; but I'm open to arguments, if there's a case I haven't thought of.

Discussed in the accessibility bug scrub, and agreed.

#8 @poena
2 years ago

I agree with closing this ticket.
The wp-site-blocks class name is included in all block themes, on an en element that wraps all blocks.

I would like to learn the motivation behind and reason for why the filter is needed, without that, it is difficult to re-consider the need.

---
If the proposed filter was used to alter the <div> to <main> specifically, it would wrap everything, including new and existing blocks that uses the <main> HTML tag, as well as the site header and site footer.

Besides the options in the user interface, there are block filters that may be more appropriate to use, that can filter the tag name on the correct and appropriate block: a block that only wraps the actual main content.

#9 @sabernhardt
2 years ago

  • Milestone Awaiting Review
  • Resolutionwontfix
  • Status assignedclosed

Without an explanation for the use case, I also agree to close the ticket.

Note: See TracTickets for help on using tickets.