-
Notifications
You must be signed in to change notification settings - Fork 4.8k
LinkControl crashing block in Pattern Editor #65874
Copy link
Copy link
Labels
[Feature] Link EditingLink components (LinkControl, URLInput) and integrations (RichText link formatting)Link components (LinkControl, URLInput) and integrations (RichText link formatting)[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Metadata
Metadata
Assignees
Labels
[Feature] Link EditingLink components (LinkControl, URLInput) and integrations (RichText link formatting)Link components (LinkControl, URLInput) and integrations (RichText link formatting)[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Type
Fields
Give feedbackNo fields configured for Bug.
Description
The

LinkControlcomponent from the@wordpress/block-editorpackage does not work as expected when used inside the Pattern Editor. The block crashes with some JS errors in the console:Here's the error with

SCRIPT_DEBUGset totrueStep-by-step reproduction instructions
Steps to Reproduce
Create a Pattern with a block that contains a
LinkControlOpen Pattern Editor
Open the Pattern with the LinkControl
All I know is that the error is caused by the
useCopyToClipboardhook inside used byLinkPreviewcomponent internally inLinkControl.I tried installing the Gutenberg Plugin 19.3 but it still crashes.
Screenshots, screen recording, code snippet
I created a simple test repo with WP and a theme with block that contains a LinkControl to reproduce the issue: repo block edit.js
Environment info
WordPress Version: 6.6.2
Browser: Chrome 127
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
UPDATE:
The issue appears after WP 6.5. Before that the example block doesn't crash in the Pattern Editor.
Update:
Added a comment describing the problem and a possible solution