WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.18k forks source link

Skip to content link is added even if theme includes a skip to content link #32433

Closed philbuchanan closed 3 years ago

philbuchanan commented 3 years ago

In a more recent version of Gutenberg (not sure entirely which version) a feature was added to automatically add a "skip to content" link. This link is added even if the theme includes a skip to content link itself. This results in a double "skip to content" link.

Expected behaviour

I would expect the auto "skip to content" link to be an opt-in feature. I'm also not currently aware of how to opt-out. But if I must opt-out, I will need to update every site I have created in the past. Since I create custom themes for each client, that will result in a lot of additional work.

Screenshots or screen recording (optional)

WordPress auto "skip to content" link:

Screen Shot 2021-06-03 at 10 01 46 AM

My "skip to content" link:

Screen Shot 2021-06-03 at 10 01 52 AM

WordPress information

Device information

aristath commented 3 years ago

Thank you for reporting this @philbuchanan The automatic skip-link should only be added when using a block theme (full site editing enabled). Nothing should be added for "classic" themes, are you saying you're seeing a duplicate skip-link when using a classic theme? I tested this with the twentytwenty theme (which adds its own skip-link) and gutenberg-trunk, I didn't see a duplicate :thinking:

block themes don't have access to PHP templates, so when using such theme, an automatic skip-link is generated when possible and added.

philbuchanan commented 3 years ago

@aristath Yes, I am using a "classic" theme. It is a custom theme though.

aristath commented 3 years ago

I think I see what's happening... Marked this as a bug and assigned to myself. I'll look into this :+1: (also added the backport-to-wp tag 'cause this feature is in WP5.8 for block templates)