Opened 10 days ago
Closed 4 days ago
#64698 closed defect (bug) (fixed)
Editor: @wordpress/theme style enqueue missing
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Editor | Keywords: | |
| Focuses: | Cc: |
Description
From what I've researched, the DataView in the site editor has some layouts based on new design tokens from the @wordpress/theme package. For example, the new Stack component applies gaps using the --wpds-dimension-gap-{size} CSS variable. However, this CSS variable itself has not been enqueued, causing the layout to break.
If it is intended that UIs based on this new design token be exposed to WP 7.0, we will need to add wp-theme to $package_styles in order to enqueue these CSS variables.
For example, making the following changes will solve the problem:
-
src/wp-includes/script-loader.php
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index f9ea36720b..bde5e70a4e 100644
a b function wp_default_styles( $styles ) { 1776 1776 'wp-reusable-blocks', 1777 1777 'wp-patterns', 1778 1778 'wp-preferences', 1779 1779 1780 ), 1780 1781 'format-library' => array(), 1781 1782 'list-reusable-blocks' => array( 'wp-components' ), … … function wp_default_styles( $styles ) { 1783 1784 'patterns' => array( 'wp-components' ), 1784 1785 'preferences' => array( 'wp-components' ), 1785 1786 'nux' => array( 'wp-components' ), 1787 1786 1788 'widgets' => array( 1787 1789 'wp-components', 1788 1790 ), … … function wp_default_styles( $styles ) { 1885 1887 'wp-reusable-blocks', 1886 1888 'wp-patterns', 1887 1889 'wp-nux', 1890 1888 1891 'wp-widgets', 1889 1892 // Deprecated CSS. 1890 1893 'deprecated-media',
cc @0mirka00, @aduth, @mciampini
Attachments (1)
Change History (9)
#1
@
9 days ago
I think the proposed patch is certainly how we'll want to think about introducing the theme styles to all the Gutenberg app entrypoints. I'm a little hesitant about over-exposing the tokens now if it limits the ability to change them moving forward (e.g. there's still some discussion of typography naming).
I wonder if the changes proposed by @0mirka00 in Gutenberg#75589 would work as a solution here. The goal of that pull request is to add reasonable fallback values in exactly these types of scenarios where the token stylesheet may not be present. And with current usage, the fallbacks are exactly what the "true" values would be anyways.
I think that change would be reasonably contained to the new component implementations, but if that would be too significant a change to land and backport for 7.0, an alternative could be to temporarily (for 7.0) swap the implementation of Stack used in DataViews to use e.g. a local copy that doesn't depend on the tokens.
#2
follow-up:
↓ 3
@
9 days ago
an alternative could be to temporarily (for 7.0) swap the implementation of Stack used in DataViews to use e.g. a local copy that doesn't depend on the tokens.
Are there any components based on design tokens exposed in WP 7.0 other than the Stack components?
#3
in reply to:
↑ 2
@
9 days ago
Are there any components based on design tokens exposed in WP 7.0 other than the Stack components?
Just Stack and Badge.
@aduth @mciampini and I agreed that the preferred solution would be to enable the fallback plugins (https://github.com/WordPress/gutenberg/pull/75589) in the build script, rather than temporarily patch things in the actual source code. We were planning to enable those plugins anyway, so it's not a temporary "workaround" for this specific 7.0 problem that we'd have to revert later.
#4
@
9 days ago
Should/can we backport the fallback plugin to 7.0?
If it's possible, that's fine, but if it can't be backported, I think it would need special fix for 7.0.
#5
@
9 days ago
So my understanding of the backport process is (could be wrong):
- Add a backport tag to the PR.
- These changes get cherry picked onto the
wp/7.0branch. - Packages get rebuilt from the
wp/7.0branch and are published to npm. - WP Core syncs these new npm packages for the release.
So long as step 3 is using the build tooling from the wp/7.0 branch itself, it should technically work.
#6
@
9 days ago
It's important to note that from the Beta1 phase onwards, only bug fixes that occurred in that release are permitted.
Therefore, if GB 75589 is considered a major enhancement, it may not be possible to cherry-pick GB 75589 into 7.0 in the first place. In that case, we'll need to submit a PR to the wp/7.0 branch directly with a temporary fix for the 7.0 release.
cc @youknowriad
#7
@
9 days ago
If the bug here is defined as "certain parts of the UI aren't rendering correctly without the design tokens stylesheet", then both approaches are equally just bug fixes. Having fallbacks in the built stylesheets isn't adding new features in any way, and is functionally equivalent to manually addressing those CSS variables in the source code.
Adding new plugins to wp-build could indeed be considered a new feature, but still only a new feature for wp-build, which is not part of the WP release.
Just leaving a trace of our justification here, so we can point to it.
Template list page in the site editor. There's no spacing where there should be.