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

Font Size Picker inconsistencies--is "normal" a required size? #17908

Open
robincornett opened this issue Oct 11, 2019 · 0 comments · May be fixed by #18273

Comments

@robincornett
Copy link

@robincornett robincornett commented Oct 11, 2019

Describe the bug
If a theme declares custom editor-font-sizes, but does not include a normal font size, the font picker selection ends up with some unexpected behaviors, such as:

  • the first defined font size is set as the "default", but not applied
  • in order to set the first defined font size as the size for the block, the user needs to select a different font size, and then select the first one
  • looking at the font size under Text Settings, there is confusion because it may be showing "Small" as the font size, even if that's not what's been applied.

Looking at the FontSizePicker component, it appears that the "default" or fallback font size is normal (ref), which results in this unexpected behavior when there is no defined normal font size.

To reproduce
Steps to reproduce the behavior:

  1. Activate the Twenty Twenty theme
  2. Create a new post and add some content (paragraphs)
  3. Look at the Text Settings panel on the side
  4. See "Small" for Font Size, which suggests that the current paragraph is set to the Small font size, when actually no size has been applied

Expected behavior
When a paragraph or other block allows for a font size picker, I would expect an empty option to be the default state of the select field, especially if not changing the select field results in no class or custom style being applied.

Ideally, I would like the first/default option to be labeled "Default", with no value, which seems consistent with what's being saved to the block content (currently no value if nothing is changed or if the font size is reset).

However, if a specific font size (normal) is required, I think that information needs to be added to the Block Editor Handbook.

Themes can "fix" this by always defining a normal font size, although even that can have some possible issues: for example, Twenty Twenty (in 5.3 nightly) sets the body font size to 1.8rem, so if a user selects the "Regular" font size from the font picker dropdown, the block is actually rendered at 16px because of how the has-regular-font-size class is defined in the block-library/style.css, and the theme does not currently redefine that font size.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Firefox, Chrome
  • Version: FF/69.0.2 (64-bit), Chrome/77.0.3865.90 (Official Build) (64-bit)

Additional context

  • Gutenberg 6.6 and/or WP 5.3 nightly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.