Repository navigation
Description
Describe the bug
This may be a known issue but I could not find information about it when searching.
It is the first time I encounter the problem.
I was attempting to remove add_theme_support from my (fse) theme and replace it with the theme.json equivalent.
I replaced the custom spacing theme support with
"spacing": {
"customPadding": true
},
and everything worked as expected.
But then I removed add_theme_support( 'custom-units' ); and the editor setting for custom padding stopped working.
Console JS error:
react-dom.production.min.js:125 TypeError: c.map is not a function
at Cn (index.js?ver=03a17f333e4ad03901f675c7a322242c:9)
at we (react-dom.production.min.js:84)
at zj (react-dom.production.min.js:226)
at Th (react-dom.production.min.js:152)
at tj (react-dom.production.min.js:152)
at Te (react-dom.production.min.js:146)
at react-dom.production.min.js:61
at unstable_runWithPriority (react.production.min.js:25)
at Da (react-dom.production.min.js:60)
at Pg (react-dom.production.min.js:61)
Also tested with TT1 Blocks.
To reproduce
Steps to reproduce the behavior:
- Activate a theme that has support for custom padding, like TT1 blocks.
- In the post editor, add a cover block and adjust the custom padding. Save.
- Remove the
add_theme_support( 'custom-units' );If using TT1 Blocks, this is on line 227 in functions.php. - In the post editor, select the cover block or refresh the page. See that the cover block errors with "This block has encountered an error..."
- Add a second cover block. See that this cover block also errors.
Expected behavior
I expect the setting to work, even if only the default px values would be available.
If the custom padding requires the custom-unit, then it should not rely on the custom-unit theme support?
Editor version (please complete the following information):
WordPress version: 5.6
Gutenberg 9.6. rc-1 current master (last update e6f43ca)
Desktop (please complete the following information):
OS: Windows 10
Browser Chrome Version 87.0.4280.88
Activity
carolinan commentedon Jan 29, 2021
I want to add that this is not unique to full site editing themes. If I remove the
add_theme_support( 'custom-units' );from Twenty Twenty-One then #28548 no longer works.
oandregal commentedon Jan 29, 2021
I used TwentyTwentyOne for testing and can repro:
custom-spacingdoesn't work withoutcustom-units. I'm not sure how they are supposed to work together, but I presume what Carolina suggested (use px) is fine.cc @ItsJonQ what do you think of this?
ItsJonQ commentedon Jan 29, 2021
Thanks for the heads up @carolinan + @nosolosw ! I just created a PR with a fix