Skip to content
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

Link Control: Creating Empty Text Link from Selection says link is empty #58415

Closed
jeryj opened this issue Jan 29, 2024 · 6 comments · Fixed by #58771
Closed

Link Control: Creating Empty Text Link from Selection says link is empty #58415

jeryj opened this issue Jan 29, 2024 · 6 comments · Fixed by #58771
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Type] Bug An existing feature does not function as intended

Comments

@jeryj
Copy link
Contributor

jeryj commented Jan 29, 2024

Description

When creating a new link without any highlighted text, the preview says link is empty.

I suspect the same root issue for this is the same root issue for #58325

Step-by-step reproduction instructions

  1. In the block editor
  2. with no text highlighted
  3. Command + K to create a link
  4. Select a page/post from the suggested options
  5. Link Preview the "Link is empty" message

Screenshots, screen recording, code snippet

Link Preview with Link is empty message

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@jeryj jeryj added [Type] Bug An existing feature does not function as intended [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) labels Jan 29, 2024
@jeryj
Copy link
Contributor Author

jeryj commented Feb 6, 2024

I think this might be due to the caret being placed outside of the link edge instead of inside of it. When creating a link with a selection, it places the cursor at the inside edge of the linked text. When creating it from an empty selection, it places it on the outside edge.

Screen.Recording.2024-02-06.at.1.37.49.PM.mov

@draganescu
Copy link
Contributor

I think we should place the caret outside the link and not show the Link UI when the link was created with no selection. That as opposed to fixing this by placing the caret inside the crested link.

@jeryj
Copy link
Contributor Author

jeryj commented Feb 7, 2024

I believe a big part of this redone link creation UX was for the link preview to remain open after link creation. I believe it remains open after selected text links, so it should probably work the same way. @richtabor, can you confirm?

@richtabor
Copy link
Member

I think we should place the caret outside the link and not show the Link UI when the link was created with no selection. That as opposed to fixing this by placing the caret inside the crested link.

Curious why you would treat link creation with text selection and no text-selection differently?

@draganescu
Copy link
Contributor

Curious why you would treat link creation with text selection and no text-selection differently?

Because without text selection the link inserting operation is in the writing flow, while with text selection the flow is interrupted to apply a format. In select text > apply format flow we also move focus away from the content to the UI, which for inserting a link while writing would be very jarring.

@richtabor
Copy link
Member

I think we should place the caret outside the link and not show the Link UI when the link was created with no selection. That as opposed to fixing this by placing the caret inside the crested link.

Ok cool. That's fine, let's try that and see how it feels in practice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Type] Bug An existing feature does not function as intended
Projects
Development

Successfully merging a pull request may close this issue.

3 participants