-
Notifications
You must be signed in to change notification settings - Fork 842
Notifications: do not rely on admin-bar styles #13690
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
Conversation
Follow up from #13450 In some cases, admin-bar styles may be dequeued (like when the Masterbar module is active).
|
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: November 5, 2019. |
|
@jeherve If the stylesheet is not marked as having an if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
add_filter(
'style_loader_tag',
function ( $tag, $handle ) {
if ( in_array( $handle, [ 'wpcom-notes-admin-bar', 'noticons' ], true ) ) {
$tag = preg_replace( '/(?<=<link)(?=\s|>)/i', ' data-ampdevmode', $tag );
}
return $tag;
},
10,
2
);
} |
This also adds the dependency back: #13690 (comment)
|
@westonruter That makes sense, thank you. How about a different approach, like this? |
|
I don't know much about the Masterbar, but the change should work. Nevertheless, since |
|
I'm marking this as approved since it does resolve the original issue. When using AMP in canonical mode, the traditional admin bar is on the front end -- is this expected? No issues or errors, but different behavior with AMP on vs off. Marking as Need Author Reply as I'm deferring to @jeherve's opinion, but fine to merge to me to help Atomic and we can fix up if the AMP issue is an issue later. |
I noticed this when testing AMP on the weekend. Does Jetpack influence this? There used to be an option in the AMP plugin whether or not to display the admin bar, but that option is no longer there. IMO it would be better not to display the admin bar because it is adding extra CSS to the page that might affect the CSS treeshake (like bumping out other CSS for being over the 50kb limit). |
|
As of AMP v1.3 the admin bar no longer counts against the 50KB limit. This is why there is no longer an option to disable the admin bar on AMP pages. |
|
To clarify, my curiosity was more that the traditional admin bar was present on an AMP page and not the wpcom masterbar. Between the options of the traditional admin bar or no admin bar at all, I'd like to see the traditional admin bar given AMP canonical would be the primary post view experience. |

Follow up from #13450
Changes proposed in this Pull Request:
cc @westonruter
Testing instructions:
Proposed changelog entry for your changes: