Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions backport-changelog/7.1/12312.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/12312

* https://github.com/WordPress/gutenberg/pull/79511
Comment thread
aaronrobertshaw marked this conversation as resolved.
Resolved
2 changes: 1 addition & 1 deletion lib/block-supports/elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function gutenberg_render_elements_support_styles( $parsed_block ) {
)
);

if ( isset( $element_style_object[':hover'] ) ) {
if ( isset( $element_style_object[':hover'], $element_config['hover_selector'] ) ) {
gutenberg_style_engine_get_styles(
$element_style_object[':hover'],
array(
Expand Down
15 changes: 15 additions & 0 deletions phpunit/block-supports/elements-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,21 @@ public function data_elements_block_support_styles() {
),
'expected_styles' => '/^.wp-elements-(?:[a-f0-9]{32}|[0-9]+) .wp-element-button, .wp-elements-(?:[a-f0-9]{32}|[0-9]+) .wp-block-button__link' . $color_css_rules . '$/',
),
'button hover styles are skipped without a hover selector' => array(
'color_settings' => array( 'button' => true ),
'elements_styles' => array(
'button' => array(
'color' => $color_styles,
':hover' => array( 'color' => $color_styles ),
),
),
/*
* Only the base button rule should be emitted. The button element
* type has no `hover_selector`, so the `:hover` object must be
* ignored rather than triggering an undefined array key warning.
*/
'expected_styles' => '/^.wp-elements-(?:[a-f0-9]{32}|[0-9]+) .wp-element-button, .wp-elements-(?:[a-f0-9]{32}|[0-9]+) .wp-block-button__link' . $color_css_rules . '$/',
),
'link element styles are applied' => array(
'color_settings' => array( 'link' => true ),
'elements_styles' => array(
Expand Down
Loading