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

Block Support: Fix font size style when applying block support #26762

Merged

Conversation

aaronrobertshaw
Copy link
Contributor

Description

Fixes the font size block support style when applied server side. Previously, the generated style contained pxpx making it invalid CSS.

How has this been tested?

Manually.

Testing Instructions

  1. Add a navigation block (or any dynamic block using font size support) to a post
  2. Set custom font size via inspector controls and confirm the incorrect style on the frontend.
  3. Apply this PR
  4. Refresh the frontend and confirm the style is now valid and displays correctly.

Screenshots

Before After
FontSize-Before FontSize-After

Types of changes

Bug Fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@@ -76,7 +76,7 @@ function gutenberg_apply_typography_support( $block_type, $block_attributes ) {
if ( $has_named_font_size ) {
$classes[] = sprintf( 'has-%s-font-size', $block_attributes['fontSize'] );
} elseif ( $has_custom_font_size ) {
$styles[] = sprintf( 'font-size: %spx;', $block_attributes['style']['typography']['fontSize'] );
$styles[] = sprintf( 'font-size: %s;', $block_attributes['style']['typography']['fontSize'] );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch @aaronrobertshaw 👍

@jorgefilipecosta jorgefilipecosta merged commit 4e80d53 into WordPress:master Nov 9, 2020
@github-actions github-actions bot added this to the Gutenberg 9.4 milestone Nov 9, 2020
@youknowriad
Copy link
Contributor

I guess this needs backporting to Core?

@youknowriad youknowriad added the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Nov 18, 2020
@tellthemachines tellthemachines mentioned this pull request Nov 30, 2020
6 tasks
tellthemachines added a commit that referenced this pull request Dec 1, 2020
* Provide a minimum of code wrapping for the code block. (#26623)

* Block Support: Fix font size style when applying block support (#26762)

* Fix Separator editor styles (#27071)

* Fix the Post author selector for contributors (#26554)

Co-authored-by: Riad Benguella <benguella@gmail.com>

* Align single half width column to left (#27142)

* remove the auto margin for individual column blocks

* update margin values for blocks in blocks to zero insted of auto

* Add backward compatibility support for lightBlockWrapper in getSaveElement (#27189)

* Code block: paste plain text (#27236)

* paste plain text option

* Add e2e test

* Fix crash when null date passed to TimePicker (#27316)

* Fix crash when null date passed.

* Update test

* Fix GH actions "cancel" step (#27025)

* use new syntax for setting env var

* Update package-lock

* Update package-lock again

* Remove the button only option from the UI until it can be wired up to something that works in the front end. (#27379)

* Fix combobox csuggestion list closure when clicking scrollbar (#27367)

Co-authored-by: Joen A <1204802+jasmussen@users.noreply.github.com>
Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
Co-authored-by: Nik Tsekouras <ntsekouras@outlook.com>
Co-authored-by: Adam Silverstein <adamsilverstein@earthboundhosting.com>
Co-authored-by: Riad Benguella <benguella@gmail.com>
Co-authored-by: andrei draganescu <me@andreidraganescu.info>
Co-authored-by: Daniel Richards <daniel.richards@automattic.com>
Co-authored-by: Ella van Durpe <wp@iseulde.com>
Co-authored-by: Noah Allen <noahtallen@gmail.com>
Co-authored-by: Andy Peatling <apeatling@users.noreply.github.com>
@tellthemachines tellthemachines removed the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants