WordPress.org

Make WordPress Core

#46290 closed defect (bug) (fixed)

Port from Gutenberg editor: Fix: Impossible to set empty array on editor-font-sizes.

Reported by: jorgefilipecosta Owned by: desrosj
Milestone: 5.2 Priority: normal
Severity: normal Version: 5.0
Component: Editor Keywords: has-patch
Focuses: Cc:

Description

This ticket ports to core a fix already applied in the Gutenberg editor plugin.
This part of the code is going to be removed from the plugin so it is important to get this change on the core.
Gutenberg PR: https://github.com/WordPress/gutenberg/pull/13824

More details:
When setting an empty array on editor-font-sizes theme support setting nothing happens, and the default font-sizes were used by the editor.
This patch fixes the problem and makes sure that when add_theme_support('editor-color-palette', array()); is added no available font sizes appear on the editor. This patch uses the same approach used in colors and makes the behavior consistent with what happens when an empty array is set on editor-color-palette.

Attachments (3)

46290.diff (394 bytes) - added by jorgefilipecosta 22 months ago.
empty-font-sizes-dropdown.png (14.4 KB) - added by desrosj 21 months ago.
no-empty-dropdown.png (16.0 KB) - added by desrosj 21 months ago.

Download all attachments as: .zip

Change History (14)

#1 @pento
22 months ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 5.1.1
  • Version changed from trunk to 5.0

#2 @SergeyBiryukov
21 months ago

  • Component changed from General to Editor

#3 @SergeyBiryukov
21 months ago

  • Keywords dev-reviewed added

46290.diff looks good to me.

This ticket was mentioned in Slack in #core by lukecarbis. View the logs.


21 months ago

#5 @desrosj
21 months ago

  • Owner set to desrosj
  • Status changed from new to assigned

#6 @desrosj
21 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 44782:

Editor: Allow the default font size options to be removed.

Similar to editor-color-palette, a theme or plugin should be able to set the theme support for editor-font-sizes to an empty array, indicating that no additional font sizes should be available in the block’s ‘Text Settings’. The current conditional was using empty(), which was incorrectly causing the default font sizes to be used instead.

Props jorgefilipecosta, chrisvanpatten, SergeyBiryukov.
Fixes #46290.

#7 @desrosj
21 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for backport consideration.

I was going to note that even after setting editor-font-sizes to array(), the dropdown still "opens". But, that seems to be fixed upstream and can be expected in 5.2.

Wondering if we should not backport this so the bug is not visible.

Last edited 21 months ago by desrosj (previous) (diff)

#8 @desrosj
21 months ago

I previously included the wrong upstream link for the bug I detailed. The correct PR is this one: https://github.com/WordPress/gutenberg/pull/13782.

This ticket was mentioned in Slack in #core by desrosj. View the logs.


21 months ago

#10 @pbiron
21 months ago

  • Milestone changed from 5.1.1 to 5.2

During the 5.1.1 bug scrub today, it was decided to punt this to 5.2.

#11 @desrosj
21 months ago

  • Keywords commit dev-reviewed removed
  • Resolution set to fixed
  • Status changed from reopened to closed

I have tested this after the changes from https://github.com/WordPress/gutenberg/pull/13782GB-13782 were merged into trunk in [44808], and the field no longer displays an empty dropdown when an empty array is specified as the value for editor-font-sizes theme support.

Note: See TracTickets for help on using tickets.