Add setting to expand typography controls in the block inspector#824
Conversation
Adds an opt-in "Editor preferences" panel in the Create Block Theme sidebar with a single toggle that expands every typography control in the block inspector by default, instead of hiding them behind the ToolsPanel ellipsis menu. Intended for theme authors iterating on typography. - New blocks.registerBlockType filter populates __experimentalDefaultControls on supports.typography based on the controls the block already declares. Mapping verified against gutenberg/packages/block-editor/src/components/global-styles/ typography-panel.js. - Preference stored in @wordpress/preferences under scope create-block-theme, key expandAllTypographyControls. - Toggle auto-reloads the editor in both directions, matching the existing save/reset/variation reload pattern in CBT. - Applies in the Site Editor only (CBT's sidebar bundle is gated to site-editor.php); help text notes this. Fixes #823
The eslint-import-resolver-typescript used by @wordpress/eslint-plugin v24 fails to resolve @wordpress/hooks specifically, while other @wordpress/* packages that are likewise externalized at build time (data, preferences, notices, i18n) resolve fine. Suppress the rule on the single affected import with a comment explaining why.
Match the layout pattern used by save-panel and create-panel so the checkbox aligns with the screen header instead of sitting flush against the left edge.
Match the pattern used by the create and save panels so the user gets a blocking confirmation before the editor reloads, instead of a snackbar that disappears with the page.
Fit text is supported by Heading and Paragraph but is registered as its own ToolsPanelItem outside TypographyPanel, so it ignores __experimentalDefaultControls and stays behind the ellipsis. The 'expand all' wording was therefore inaccurate.
|
Note on the "Fit text" gap: only the Heading and Paragraph blocks declare |
Preserves any keys a block already set on its typography defaults that are outside our mapping table — e.g., a future or third-party control key we don't know about. Our computed values still win for keys we do know, which is the point of the opt-in preference.
mikachan
left a comment
There was a problem hiding this comment.
This looks good to me! Code changes look good. I think we can bring this in so we can test it out 🙌



Summary
Adds an opt-in Editor preferences panel in the Create Block Theme sidebar with a single toggle that expands every typography control in the block inspector by default, instead of hiding them behind the ToolsPanel ellipsis menu. Intended for theme authors iterating on typography.
Fixes #823.
Why
Adjusting typography in the Site Editor takes two steps per control today: open the ellipsis menu, enable the control, then set the value. For theme authors iterating across many blocks and elements, this adds up. The issue has more context (#823), including the related upstream discussions in gutenberg#41376 and gutenberg#41544.
The narrow scope here — plugin-only, reversible by toggling off or deactivating CBT.
New files
src/editor-enhancements/expand-typography-controls.js— mapping table, pureexpandTypographyDefaults(), and ablocks.registerBlockTypefilter that populates__experimentalDefaultControlsbased on the typography supports the block already declares.src/editor-sidebar/editor-preferences-panel.js— new panel with a singleCheckboxControl. Toggle writes the preference, firescreateInfoNotice('Applying…'), and reloads the editor.src/test/expand-typography-controls.test.js— 13 unit tests for the pure mapping function (null/undefined, each support key,fontAppearancemerge, falsy filtering, full shape, key preservation) plus one mapping-table sanity check.Modified
src/plugin-sidebar.js— side-effect import of the filter at the top (so it registers before block registration),cogicon, menu item under/editor-preferences, newNavigatorScreen.readme.txt— one bullet under Description.Design decisions
blocks.registerBlockTypeonly fires at registration time. Auto-reload matches the pattern already used.create-block-theme, same store as existing save-panel preferences. It really is only helpful while authoring a theme.$pagenow === 'site-editor.php'inincludes/class-create-block-theme-editor-tools.php:19, so the filter doesn't load in the post editor. The help text notes this. Broader coverage (splitting the filter into its own unconditionally-enqueued script) is a plausible v2.Mapping source
Verified against
gutenberg/packages/block-editor/src/components/global-styles/typography-panel.jsontrunk.fontWeightandfontStylecollapse into a singlefontAppearancecontrol. If the__experimental*keys rename in core, onlyexpand-typography-controls.jsneeds to change.Open questions for reviewers
From issue #823:
Test plan
A Claude-assisted PR.
Here are a few visusal:
Video:
Screen.Recording.2026-04-24.at.11.19.26.mov