Skip to content

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

@pierlon

Description

@pierlon

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions