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

Global Styles: enqueue styles later so theme css can load first #34147

Closed
wants to merge 1 commit into from

Conversation

creativecoder
Copy link
Contributor

@creativecoder creativecoder commented Aug 18, 2021

Description

Deenqueues and deregisters the 'global-styles' asset enqueued by Core, and reenqueues it on a later priority.

This allows theme css enqueued on the default priority to load first, so that a user's Global Style settings take precedence over theme css (particularly in the case of equal css selector weight).

Fixes #34141

Example of conflicts with themes: Automattic/themes#4435

How has this been tested?

Ensure that Global styles is loaded after the theme css on the page.

Screenshots

Screen Shot 2021-08-18 at 14 09 34

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

Copy link
Contributor

@jeyip jeyip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing

Requirements

  • With the blockbase theme, the global-styles-inline-css stylesheet is loaded after theme stylesheets
  • With the mayland blocks theme, the global-styles-inline-css stylesheet is loaded after theme stylesheets

Browsers

  • Edge
  • Firefox
  • Safari
  • Chrome

This makes sense to me 👍 Waiting for folks with more global styles experience to chime in before +1

Copy link
Member

@oandregal oandregal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current behavior is how it's expected to work, so going to ask for more info on the issue before we go further with this.

@creativecoder creativecoder added the [Status] Needs More Info Follow-up required in order to be actionable. label Aug 19, 2021
@creativecoder
Copy link
Contributor Author

I'll close this for now, since the discussion in #34141 looks like it's leading to more nuanced solution.

@oandregal oandregal deleted the fix/enqueue-global-styles-after-themes branch August 23, 2021 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Status] Needs More Info Follow-up required in order to be actionable.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Global Styles: consider loading user styles after theme styles
3 participants