Skip to content

Resolves conflict with custom link class UI added in wp 69#22822

Merged
vraja-pro merged 6 commits intotrunkfrom
22705-conflict-with-custom-link-class-ui-added-in-wp-69
Dec 19, 2025
Merged

Resolves conflict with custom link class UI added in wp 69#22822
vraja-pro merged 6 commits intotrunkfrom
22705-conflict-with-custom-link-class-ui-added-in-wp-69

Conversation

@JorPV
Copy link
Contributor

@JorPV JorPV commented Dec 15, 2025

Context

  • The custom link class UI added in WP 6.9 is not available when Yoast SEO is enabled.

Summary

This PR can be summarized in the following changelog entry:

  • Fixes a bug where WordPress link classes were not being recognized when Yoast SEO was active. Props to benoitchantre.

Relevant technical choices:

  • The issue is that WordPress 6.9 added a new class attribute to links via Add Additional CSS Classes setting to Link UI WordPress/gutenberg#67560, but Yoast's link format definition doesn't include it. This causes a mismatch that breaks the LinkControl component.
  • Added the hasTextControl={ true } prop to the LinkControl component that explicitly enables the text control field allowing users to edit link text.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Deactivate Yoast SEO Free + Premium plugin
  • Open or create a post in Gutenberg editor and add a link to it.
image
  • Once added, click to edit the link.
  • Confirm that you see the Text and Link fields, and the advanced options.
image
  • Save the post.
  • Activate the Yoast SEO Free plugin
  • Open the same post again and click to edit the link you added before.
  • Confirm that you see the Text and Link field and the advanced options, as previously to activating the Yoast plugin.
  • Edit the at least one of the fields (ideally both)
  • Apply the changes and save the post.
  • Open the post in the preview and confirm that your changes work.
  • Deactivate the Yoast SEO Free plugin once again.
  • Open the post once more, click on the edit link and confirm that your changes made with the Yoast SEO plugin active persist.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.
  • I have ran grunt build:images and commited the results, if my PR introduces new images or SVGs.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #22705

@JorPV JorPV added the changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog label Dec 15, 2025
@JorPV JorPV linked an issue Dec 15, 2025 that may be closed by this pull request
11 tasks
@coveralls
Copy link

coveralls commented Dec 15, 2025

Pull Request Test Coverage Report for Build b2253d7230b0746e5ffcf3aed0b4cac30b178d85

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 6 of 60 (10.0%) changed or added relevant lines in 2 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-21.6%) to 31.422%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/inline-links/inline.js 0 54 0.0%
Files with Coverage Reduction New Missed Lines %
packages/js/src/inline-links/inline.js 5 0.0%
Totals Coverage Status
Change from base Build 69bfc7a0eb4fb6181e82880d9b9bf88dea135f93: -21.6%
Covered Lines: 5266
Relevant Lines: 15553

💛 - Coveralls

@JorPV JorPV modified the milestone: 26.8 Dec 16, 2025
@JorPV JorPV marked this pull request as ready for review December 16, 2025 12:44
@vraja-pro vraja-pro requested a review from Copilot December 19, 2025 12:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a compatibility issue between Yoast SEO and WordPress 6.9's new link class attribute feature. WordPress 6.9 introduced custom link classes via the LinkControl component, but Yoast's custom link format definition was missing this attribute, causing the LinkControl to malfunction when Yoast SEO was active.

Key Changes:

  • Extended the link format definition to include type, id, and class attributes to match WordPress core's link format
  • Added hasTextControl={true} prop to LinkControl component to explicitly enable text editing
  • Refactored link update logic to properly handle text changes using WordPress's recommended remove/insert pattern

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/js/src/inline-links/edit-link.js Added type, id, and class attributes to link format definition
packages/js/src/inline-links/utils.js Extended createLinkFormat function to support new attributes
packages/js/src/inline-links/inline.js Refactored link handling logic and added hasTextControl prop
packages/js/tests/inline-links/utils.test.js Added comprehensive unit tests for the updated utility functions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@vraja-pro vraja-pro left a comment

Choose a reason for hiding this comment

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

CR & AC ✅

@vraja-pro vraja-pro added this to the 26.8 milestone Dec 19, 2025
@vraja-pro vraja-pro merged commit fc4110e into trunk Dec 19, 2025
20 checks passed
@vraja-pro vraja-pro deleted the 22705-conflict-with-custom-link-class-ui-added-in-wp-69 branch December 19, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conflict with custom link class UI added in WP 6.9

4 participants