-
Notifications
You must be signed in to change notification settings - Fork 382
Description
The inclusion of the admin bar was included in AMP via #1205. However, the amount of admin bar CSS is so large (20KB) that it takes up about 40% of the total allowed CSS in AMP (50KB). For this reason it very frequently causes excessive_css validation errors when an authenticated user is browsing the frontend. As opposed to providing this option or trying to automatically disable the admin bar when there is too much CSS (#1800), we could instead just exclude admin bar CSS (including any styles that depend on admin-bar) from being considered in the 50KB budget. This can mean that an authenticated user will often be served an invalid AMP page, but this is of little importance since the unauthenticated visitor (including crawlers) will only get the valid AMP pages for indexing. The admin bar has an indicator of AMP validity already, so users who have the AMP validator browser extension would just need to trust the admin bar status rather than the browser toolbar, or else open the URL in an incognito window to double-check. AMP now supports an explicit “dev mode” (ampproject/amphtml#20974) for when invalid markup is intentionally being included in the page. The AMP validator browser extension will explicitly be aware of this mode (ampproject/amphtml#24176) so there will not be concerns about it alerting the user of errors. Initial support for dev mode in the AMP plugin landed with #3084.
👉 For full list of changes, please refer to description in PR: #3187.
Done/Obsolete
- Remove checkbox from settings screen to hide admin bar in AMP. If anyone wants to do this, they can easily do so via a
show_admin_barfilter along with a check for! is_amp_endpoint(). Most users will benefit from the admin bar. Decisions not options. (Done in Introduce stylesheet prioritization when determining which to concatenate #2346 & Remove admin-bar class name from body when admin bar element removed due to excessive CSS #2405.) - Suppress admin bar from being shown during validation requests. Done in Suppress admin bar from being shown during validation requests #2500.
-
Add note in admin bar submenu for AMP that page is not valid due to admin bar, but otherwise it is OK. -
Add link to AMP admin bar menu to navigate to the current URL without the admin bar. A query param likehide_admin_barcan be introduced. This URL can also automatically add#development=1. -
Consider removing theampattribute from thehtmlelement when the admin bar is showing to prevent the AMP Validator extension from screaming at the user.