gutenberg
gutenberg copied to clipboard
Quote and Pullquote are not valid HTML
Describe the bug
Quote and Pullquote use the HTML5 <cite>
element to indicate who made the quote, as illustrated by the previews. The HTML Living Standard says this is not allowed.
To reproduce Steps to reproduce the behavior:
- Create a post
- Add a Quote or Pullquote block
- Fill in the Quote or Pullquote fields
- Publish the post
- View the post
- Inspect the Quote or Pullquote
Expected behavior
Quote and Pullquote are valid HTML. This can be achieved by replacing the <cite>
element with another HTML element, for instance the <footer>
element as illustrated by the Mozilla Developer Network.
See previously https://github.com/WordPress/gutenberg/issues/2647
Hey @sanderteirlynck and @mtias
Is this issue still valid?
Hi @paaljoachim
Apologies for the late reply!
I'm assuming this issue is still valid since the Quote and Pullquote block both still use the cite
element as of WordPress 5.7.2 and the HTML Living Standard still notes that "a person's name is not the title of a work". Something might have changed in the Gutenberg WordPress plugin but I'm assuming it hasn't, since this issue wasn't referenced anywhere.
I believe this is also part of the refactor in https://github.com/WordPress/gutenberg/pull/25892
I looks like the Quote block in the editor uses cite
for citation; however the Pullquote block still uses div
. It would be great to have consistency in these two blocks.
Quote block
![quote-block](https://user-images.githubusercontent.com/3655965/150414944-aafee869-ee52-4c43-adaf-92f7ef250919.png)
Pullquote block
![pullquote-block](https://user-images.githubusercontent.com/3655965/150414980-5b69d148-0127-4844-9482-49d09944b2b5.png)
Note, For the quote block, this was not resolved in https://github.com/WordPress/gutenberg/pull/25892 (The Quote Block refactor that was introduced in Gutenberg 13.8; the quote block still uses cite.
Just bumping this for visibility. Still an issue in the latest RC (6.3-beta4).
This is the default output of the Quote block:
<blockquote class="wp-block-quote is-style-default">
<p>Hi there! I’m a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles,
have a great dog named Jack, and I like piña coladas. (And gettin’ caught in the rain.)</p>
<cite>The Speaker</cite>
</blockquote>
And this is the default output of the Pullquote block:
<figure class="wp-block-pullquote">
<blockquote>
<p>The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since.
Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.
</p>
<cite>The Speaker</cite>
</blockquote>
</figure>
Still invalid HTML, but also an accessibility concern (this now gets flagged on manual audits by various independent accessibility companies and experts).
Based on the same living standard link above, we should expect this as the output of both (perhaps with a class to distinguish visually, therefor eliminating the need for two blocks? #11610 ):
<figure>
<blockquote>
<p>The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since.
Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.
</p>
</blockquote>
<figcaption>The Speaker</figcaption>
</figure>
We shouldn't include figure tags on blockquotes or fig captions. It's unnecessarily verbose for screen reader users.
Adrian Roselli has a post about how screen readers announce various blockquotes that is worth referencing.
Great article. Also brings into question whom we trust when it comes to HTML validity and the nuances of semantic tags.
@amberhinds based on his advice and the merge to MDN, it would suggest that the solution in WP would be to replace the <cite>
tag with a <footer>
tag and remove the <figure>
tag from pull quotes (what was initially posted by @sanderteirlynck ).
Would you agree with that solution?
@michaelbourne, yes, I think that's what I would go with.