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

Admin manifest fails to be created if admin bar is not present on the page #33591

Closed
pierlon opened this issue Jul 21, 2021 · 4 comments · Fixed by #33702
Closed

Admin manifest fails to be created if admin bar is not present on the page #33591

pierlon opened this issue Jul 21, 2021 · 4 comments · Fixed by #33702
Assignees
Labels
[Status] In Progress Tracking issues with work in progress

Comments

@pierlon
Copy link
Contributor

pierlon commented Jul 21, 2021

Description

If the admin bar is not present on an admin page, the admin manifest script fails with the error:

Uncaught TypeError: Window.getComputedStyle: Argument 1 is not an object.

That error can be traced back to here:

const adminBar = document.getElementById( 'wpadminbar' );
const { color, backgroundColor } = window.getComputedStyle( adminBar );

I experienced this error when navigating to the Onboarding Wizard in the AMP for WordPress plugin.

Expected behaviour

Admin manifest should still be created if admin bar is not present on the page.

Actual behaviour

Admin manifest is not created if admin bar is not present on the page.

Screenshots or screen recording (optional)

image

WordPress information

  • WordPress version: 5.8
  • Gutenberg version: 11.1.0
  • Are all plugins except Gutenberg deactivated? No, the AMP for WordPress plugin is activated
  • Are you using a default theme (e.g. Twenty Twenty-One)? Yes

Device information

  • Device: Desktop
  • Operating system: Linux
  • Browser:Firefox 90
@westonruter
Copy link
Member

Introduced in #33102.

I suppose it should check if adminBar is null, and if so, use default values for color and backgroundColor.

IMO, the PWA icon shouldn't be using the WP logo anyway, but rather it should be using the site icon: GoogleChromeLabs/pwa-wp#295 (comment)

See also GoogleChromeLabs/pwa-wp#569.

cc @ellatrix

@ellatrix
Copy link
Member

@pierlon Could you share a screenshot of the page? Is the admin menu visible on the page?

@westonruter
Copy link
Member

@ellatrix No, neither the admin menu nor the admin toolbar are shown on this page.

@westonruter
Copy link
Member

It's a full-screen "wizard". In the AMP plugin, you can access it by activating and navigating to the onboarding wizard. I recall Yoast and WooCommerce have something similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants