-
Notifications
You must be signed in to change notification settings - Fork 382
Description
Bug Description
Given this markup in a Custom HTML block:
<amp-ad type="adsense" data-ad-client="ca-pub-123" data-ad-slot="456" data-ad-format="auto" data-full-width-responsive="true"><span overflow=""></span></amp-ad>This is leaking a validation error to the frontend:
Incomplete layout attributes specified for tag 'amp-ad'. For example, provide attributes 'width' and 'height'.
I thought that this would have been prevented by #3728.
This was discovered in a support topic.
Expected Behaviour
AMP components that have neither a layout nor width/height attributes should be removed entirely. An appropriate validation error should be raised in the plugin.
The corresponding AMP validation error constant is MISSING_LAYOUT_ATTRIBUTES.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
QA testing instructions
- Create a new post.
- Add the following markup into a "Custom HTML" block on the page:
<amp-img src="https://placeholder.com/350"></amp-img>
- Publish the page and visit its AMP version.
- Verify: The page should not show any validation errors (except for the "dev-mode" one) for the page.
- Go to the "Validate" screen for the page.
- Verify: The page should have 1 validation error with the following text:
Incomplete layout attributes specified for tag
amp-img. For example, provide attributeswidthandheight.
Demo
Before

The plugin's validation doesn't show any errors for the post.

However, the AMP validator complains about the post.
After

The plugin's validation catches the two offending elements and removes them.

The validation issues are not leaked into the AMP validator anymore.