Skip to content

Fix: Restore static properties on deprecated __experimentalLinkControl #69860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2025

Conversation

karthikeya-io
Copy link
Contributor

@karthikeya-io karthikeya-io commented Apr 8, 2025

What?

Closes #69861

Fixes the error while using the __experimentalLinkControl and accessing its static properties like DEFAULT_LINK_SETTINGS.

Why?

The __experimentalLinkControl was stabilized as LinkControl in PR #56384. Following this change, using __experimentalLinkControl in blocks leads to errors because it lacks the necessary static properties. This can create issues in custom blocks that still utilize __experimentalLinkControl . This PR addresses the issue by adding those static properties to DeprecatedExperimentalLinkControl.

How?

Testing Instructions

  1. Add any custom block that uses __experimentalLinkControl and access DEFAULT_LINK_SETTINGS
    or update the core button block

    to previously used __experimentalLinkControl
__experimentalLinkControl as LinkControl,
  1. Confirm the block works as expected without errors.

Testing Instructions for Keyboard

Same

Screenshots or screencast

Before After

@karthikeya-io karthikeya-io marked this pull request as ready for review April 8, 2025 19:22
@karthikeya-io karthikeya-io requested a review from getdave as a code owner April 8, 2025 19:22
Copy link

github-actions bot commented Apr 8, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: karthikeya-io <karthikeya01@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano added Backwards Compatibility Issues or PRs that impact backwards compatability [Package] Block editor /packages/block-editor [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) labels Apr 9, 2025
@t-hamano
Copy link
Contributor

t-hamano commented Apr 9, 2025

Thanks for the PR!

We have decided NOT to export the following sub-components from the deprecated component:

  • __experimentalLinkControlSearchInput
  • __experimentalLinkControlSearchResults
  • __experimentalLinkControlSearchItem

See #56384 (comment)

This decision may also apply to ViewerFill and DEFAULT_LINK_SETTINGS .

cc @fabiankaegy @youknowriad

@karthikeya-io
Copy link
Contributor Author

Although these sub-components are not exported, they still exist within DeprecatedExperimentalLinkControl(__experimentalLinkControl). However, the values ViewerFill and DEFAULT_LINK_SETTINGS are not present on this deprecated component, which is causing an error—not just a deprecation warning while using those values.

@t-hamano
Copy link
Contributor

t-hamano commented Apr 9, 2025

However, the values ViewerFill and DEFAULT_LINK_SETTINGS are not present on this deprecated component, which is causing an error

You are right. We might need to consider whether we should backport this PR into WP 6.8. Otherwise the following code causes a critical error:

__experimentalLinkControl.DEFAULT_LINK_SETTINGS
__experimentalLinkControl.ViewerFill

cc @fabiankaegy @Mamaduka

@github-project-automation github-project-automation bot moved this to 🔎 Needs Review in WordPress 6.8 Editor Tasks Apr 9, 2025
@t-hamano t-hamano moved this from 🔎 Needs Review to 🗣️ In Discussion / Needs Decision in WordPress 6.8 Editor Tasks Apr 9, 2025
@Mamaduka Mamaduka added [Type] Regression Related to a regression in the latest release Backport to WP 6.8 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Apr 10, 2025
@Mamaduka
Copy link
Member

@t-hamano, looks good to merge. Do mind handling that?

@Mamaduka Mamaduka added the props-bot Adding this label triggers the Props Bot workflow for a PR. label Apr 10, 2025
@github-actions github-actions bot removed the props-bot Adding this label triggers the Props Bot workflow for a PR. label Apr 10, 2025
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM! Tested on the browser console.

Before

image

After

image

@t-hamano t-hamano merged commit 69105aa into WordPress:trunk Apr 10, 2025
74 of 80 checks passed
@github-project-automation github-project-automation bot moved this from 🗣️ In Discussion / Needs Decision to ✅ Done in WordPress 6.8 Editor Tasks Apr 10, 2025
@github-actions github-actions bot added this to the Gutenberg 20.7 milestone Apr 10, 2025
gutenbergplugin pushed a commit that referenced this pull request Apr 10, 2025
#69860)

Co-authored-by: karthikeya-io <karthikeya01@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
@github-actions github-actions bot added Backported to WP Core Pull request that has been successfully merged into WP Core and removed Backport to WP 6.8 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta labels Apr 10, 2025
Copy link

I just cherry-picked this PR to the wp/6.8 branch to get it included in the next release: d521010

chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
WordPress#69860)

Co-authored-by: karthikeya-io <karthikeya01@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backported to WP Core Pull request that has been successfully merged into WP Core Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Package] Block editor /packages/block-editor [Type] Regression Related to a regression in the latest release
Projects
Development

Successfully merging this pull request may close these issues.

Block Editor: Accessing __experimentalLinkControl static properties throws error after stabilization
3 participants