Make WordPress Core

Changeset 57664


Ignore:
Timestamp:
02/20/2024 11:20:22 AM (4 months ago)
Author:
youknowriad
Message:

Editor: Fix instance element styles for links applying to buttons.

These changes fix the selector used by block instance element styles for links so they do not get incorrectly applied to buttons.

Props aaronrobertshaw, freewebmentor, mukesh27.
Fixes #60557.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/elements.php

    r56828 r57664  
    167167        ),
    168168        'link'    => array(
    169             'selector'       => ".$class_name a",
    170             'hover_selector' => ".$class_name a:hover",
     169            'selector'       => ".$class_name a:where(:not(.wp-element-button))",
     170            'hover_selector' => ".$class_name a:where(:not(.wp-element-button)):hover",
    171171            'skip'           => $skip_link_color_serialization,
    172172        ),
  • trunk/tests/phpunit/tests/block-supports/wpRenderElementsSupportStyles.php

    r56806 r57664  
    2323     *
    2424     * @ticket 59555
     25     * @ticket 60557
    2526     *
    2627     * @covers ::wp_render_elements_support_styles
     
    140141                    ),
    141142                ),
    142                 'expected_styles' => '/^.wp-elements-[a-f0-9]{32} a' . $color_css_rules .
    143                     '.wp-elements-[a-f0-9]{32} a:hover' . $color_css_rules . '$/',
     143                'expected_styles' => '/^.wp-elements-[a-f0-9]{32} a:where\(:not\(.wp-element-button\)\)' . $color_css_rules .
     144                    '.wp-elements-[a-f0-9]{32} a:where\(:not\(.wp-element-button\)\):hover' . $color_css_rules . '$/',
    144145            ),
    145146            'generic heading element styles are applied' => array(
Note: See TracChangeset for help on using the changeset viewer.