Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#46290 closed defect (bug) (fixed)

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

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


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:

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 5 years ago.
empty-font-sizes-dropdown.png (14.4 KB) - added by desrosj 5 years ago.
no-empty-dropdown.png (16.0 KB) - added by desrosj 5 years ago.

Download all attachments as: .zip

Change History (14)

#1 @pento
5 years ago

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

#2 @SergeyBiryukov
5 years ago

  • Component changed from General to Editor

#3 @SergeyBiryukov
5 years ago

  • Keywords dev-reviewed added

46290.diff looks good to me.

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

5 years ago

#5 @desrosj
5 years ago

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

#6 @desrosj
5 years 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
5 years 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 5 years ago by desrosj (previous) (diff)

#8 @desrosj
5 years ago

I previously included the wrong upstream link for the bug I detailed. The correct PR is this one:

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

5 years ago

#10 @pbiron
5 years 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
5 years ago

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

I have tested this after the changes from 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.