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

Don't use fluid layout value in typography calculation. #5006

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-includes/block-supports/typography.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@
: array();

// Defaults.
$default_maximum_viewport_width = isset( $layout_settings['wideSize'] ) ? $layout_settings['wideSize'] : '1600px';
$default_maximum_viewport_width = isset( $layout_settings['wideSize'] ) && ! empty( wp_get_typography_value_and_unit( $layout_settings['wideSize'] ) ) ? $layout_settings['wideSize'] : '1600px';

Check failure on line 520 in src/wp-includes/block-supports/typography.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Expected 1 space before "?"; 2 found
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$default_maximum_viewport_width = isset( $layout_settings['wideSize'] ) && ! empty( wp_get_typography_value_and_unit( $layout_settings['wideSize'] ) ) ? $layout_settings['wideSize'] : '1600px';
$default_maximum_viewport_width = isset( $layout_settings['wideSize'] ) && ! empty( wp_get_typography_value_and_unit( $layout_settings['wideSize'] ) ) ? $layout_settings['wideSize'] : '1600px';

Fix PHPCS notice

$default_minimum_viewport_width = '320px';
$default_minimum_font_size_factor_max = 0.75;
$default_minimum_font_size_factor_min = 0.25;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Theme Name: Block Theme Child Theme With Fluid Layout
Theme URI: https://wordpress.org/
Description: For testing purposes only.
Template: block-theme
Version: 1.0.0
Text Domain: block-theme-child-with-fluid-layout
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 2,
"settings": {
"appearanceTools": true,
"layout": {
"wideSize": "clamp(1000px, 85vw, 2000px)"
},
"typography": {
"fluid": true
}
}
}
5 changes: 5 additions & 0 deletions tests/phpunit/tests/block-supports/typography.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,11 @@ public function data_generate_block_supports_font_size_fixtures() {
'theme_slug' => 'block-theme-child-with-fluid-typography-config',
'expected_output' => 'font-size:15px;',
),
'returns clamp value using default config if layout is fluid' => array(
'font_size_value' => '15px',
'theme_slug' => 'block-theme-child-with-fluid-layout',
'expected_output' => 'font-size:clamp(14px, 0.875rem + ((1vw - 3.2px) * 0.078), 15px);',
),
);
}

Expand Down
Loading