Disable the default font sizes and JS TypeError #66858
Labels
[Feature] Typography
Font and typography-related issues and PRs
[Status] Duplicate
Used to indicate that a current issue matches an existing one and can be closed
[Type] Bug
An existing feature does not function as intended
Description
I'm trying to disable the defaultFontSizes (S, M, L, ...) using a filter over the theme.json (since it should be disabled only for a specific custom post type).
`add_filter('wp_theme_json_data_theme', function ($theme_json) {
I followed the instructions here: https://wpdevelopment.courses/articles/block-editor-typography-settings/#disable-font-size-controls
Setting settings.typography.defaultFontSizes to false does nothing (WP 6.6.2, no plugins, 2024 theme).
Setting settings.typography.fontSizes to and empty array, leave the "sizes box" active without options (S, M, L, ... they disappear), but if you activate the custom size selector, which starts with an empty value, moving the slider does nothing and there is a JS error:
Uncaught TypeError: n?.startsWith is not a function at Dh (block-editor.min.js?ver=7ab6a9fdca1a0386ea66:21:312023) at onChange (block-editor.min.js?ver=7ab6a9fdca1a0386ea66:21:313162)
if you try to type a size directly the paragraph block disappear (I'm testing it on a paragraph block) and you get:
This block has encountered an error and cannot be previewed.
with the same error recorded in the JS console.
It's a bug or I'm doing something wrong? The defaultFontSizes should disable the default sizes selector?
Thanks, Stefano.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
WP 6.6.2, no plugins, 2024 theme
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
The text was updated successfully, but these errors were encountered: