Make WordPress Core

Opened 2 months ago

Closed 2 months ago

Last modified 2 months ago

#61661 closed defect (bug) (duplicate)

WordPress 6.6 display all links as underlined

Reported by: simonbelley's profile simonbelley Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.6
Component: Editor Keywords:
Focuses: ui, css Cc:

Description

Since the update of WordPress 6.6 the css line: :root :where(a:where(:not(.wp-element-button))){text-decoration:underline;} broke all of my websites designs by adding underline on every links.

Change History (9)

#1 follow-up: @butterflymedia
2 months ago

I have already opened a ticket on the block editor on GitHub, and they said there is a hotfix for 6.6.1. Here is the link - https://github.com/WordPress/gutenberg/issues/63345

Still, there is a bunch of :root and :where styles overriding everything. Another example would be all centred images are now left aligned.

Regarding the underline, their reply was that this is common behaviour for browsers to underline links…

Here is the selector being added by the core:

:root :where(a:where(:not(.wp-element-button))) {
    text-decoration: underline;
}

#2 follow-up: @simonbelley
2 months ago

It's clearly not a browser behaviour since it's a css line that has been added to wordpress core in the update. Hope they fix that soon! I have multiple website and don't want to go on each one to add a css line that would override it...

#3 in reply to: ↑ 2 @butterflymedia
2 months ago

Replying to simonbelley:

It's clearly not a browser behaviour since it's a css line that has been added to wordpress core in the update. Hope they fix that soon! I have multiple website and don't want to go on each one to add a css line that would override it...

No, but that was their reason for introducing that CSS rule.

30 years ago, links were, indeed, underlined and blue. This doesn't mean we need to have them like that.

#4 @swissspidy
2 months ago

  • Component changed from General to Editor
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Severity changed from major to normal
  • Status changed from new to closed

Duplicate of #61660.

Closing as this was already reported & resolved.

#5 @butterflymedia
2 months ago

This is how I solved it, in case anyone stumbles upon this ticket. I put the code below in my theme:

:root :where(a:where(:not(.wp-block-navigation))),
:root :where(a:where(:not(.wp-element-button))) {
    text-decoration: initial;
}

#6 @carriejeeze
2 months ago

Thank you for this. I thought I was losing my mind…

#7 in reply to: ↑ 1 @jmccallweb
2 months ago

Replying to butterflymedia:

I have already opened a ticket on the block editor on GitHub, and they said there is a hotfix for 6.6.1. Here is the link - https://github.com/WordPress/gutenberg/issues/63345

Still, there is a bunch of :root and :where styles overriding everything. Another example would be all centred images are now left aligned.

Regarding the underline, their reply was that this is common behaviour for browsers to underline links…

Here is the selector being added by the core:

:root :where(a:where(:not(.wp-element-button))) {
    text-decoration: underline;
}

#8 @jmccallweb
2 months ago

Do we know when 6.6.1 will go live?

#9 @butterflymedia
2 months ago

The filter below fixed the entire issue for me:

add_action(
    'wp_head',
    function () {
    	global $wp_styles;

        if ( ! empty( $wp_styles->registered['global-styles']->extra['after'][0] ) ){
    		$wp_styles->registered['global-styles']->extra['after'][0] = str_replace(
                [
                    ':root :where',
                    ':root',
                    ':where',
                ],
                '',
                $wp_styles->registered['global-styles']->extra['after'][0]
            );
        }
    },
    1
);
Note: See TracTickets for help on using tickets.