Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected AMP validation error when aria-label contains > #2291

Closed
westonruter opened this issue May 13, 2019 · 1 comment
Closed

Unexpected AMP validation error when aria-label contains > #2291

westonruter opened this issue May 13, 2019 · 1 comment
Labels
Bug Something isn't working

Comments

@westonruter
Copy link
Member

When adding this paragraph block:

<!-- wp:paragraph -->
<p>In 'Classic' template mode, you can use the&nbsp;<a href="https://github.com/Automattic/amp-wp/blob/1b3bf237993de37eaa19be86d500a61e49759421/includes/admin/functions.php#L161" target="_blank" rel="noreferrer noopener" aria-label="In 'Classic' template mode, you can use the&nbsp;amp_post_template_analytics&nbsp;filter. This template mode is set either from selecting 'Classic' in 'AMP Settings' > 'Template Mode,' or from not calling&nbsp;add_theme_support( 'amp' ). (opens in a new tab)">amp_post_template_analytics</a>&nbsp;filter. This template mode is set either from selecting 'Classic' in 'AMP Settings' &gt; 'Template Mode,' or from not calling&nbsp;<code>add_theme_support( 'amp' )</code>.</p>
<!-- /wp:paragraph -->

AN unexpected validation error occurs:

image

image

I thought this was related to WordPress/gutenberg#8779 but apparently not. It appears the source stack comment is somehow being incorrectly injected into the attribute value. In Gutenberg, the issue would probably be fixed if > could be replaced with &gt; but every time this is manually fixed, the block serializer re-encodes as >. I thought that such characters were supposed to be encoded in WordPress/gutenberg#9963. Nevertheless, since < and > are allowed in attribute values, the validator should be resilient to them being present irrespective of Gutenberg.

@westonruter westonruter added the Bug Something isn't working label May 13, 2019
@westonruter
Copy link
Member Author

westonruter commented May 14, 2019

I don't think there is anything we can do here. It's an issue with Gutenberg's block serializer which should encode > as &gt; and it's also an issue with wptexturize() erroneously converting attribute-closing " to #8243;. See WordPress/gutenberg#9963 (comment) and now WordPress/gutenberg#15636.

Quick fix is to remove < and > from attribute values inside the_content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant