Include yoast-seo-adminbar style in AMP dev mode #13502
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In ampproject/amp-wp#3187 the AMP plugin added support for the new AMP dev mode. This allows normally invalid elements to be exempted from validation when being used in certain contexts, such as when the admin bar is being shown to authenticated users. AMP plugin v1.3 prevents the admin bar CSS from being processed and thus it is not counted against the 50KB limit in the
style[amp-custom]stylesheet. This PR does the same for the admin bar CSS added by WordPress SEO, which avoids the CSS from being tree-shaken/converted and it prevents it from being counted against the 50KB limit.Before
The CSS is included in the custom styles:
After
This PR can be summarized in the following changelog entry:
Relevant technical choices:
yoast-seo-adminbarstyle is simply marked as being dependent on the coreadmin-barstylesheet; the AMP plugin uses this as a signal to automatically add thedata-ampdevmodeattribute to the printed stylesheetlinktag.Theamp_dev_mode_element_xpathsfilter is being used to identify thelinkelements after the page has rendered, but this could have alternatively used thestyle_loader_tagfilter to inject thedata-ampdevmodeattribute instead during rendering.Test instructions
This PR can be tested by following these steps:
style[amp-custom].UI changes
Documentation
Quality assurance