Skip to content

Block Editor: Improve UX for the URL link viewer #17972

Closed

Description

@gziolo

Follow-up for #17928 where @glendaviesnz fixed the root issue of #17657:

Block disappear when clicking on a link (anchor, ) with no href

Before:

before

After:

after

One option to improve the UX is to:

I tested it with the Class block and it looks like the way it's handled there is, it gets never converted into a link if you leave the input field empty. In the case where you remove the URL and save it, it works as if you would remove the link. We should replicate the same behavior.

To reproduce

  1. Copy text from a source where there is a tag with no href
    or
    create a link with no href when editing a block in HTML mode
  2. In visual mode, click on the link or drag over it (like when you want to select text containing a anchor with no href).
  3. Check how popover behaves.

Activity

  1. added
    [Package] Block editor
    [Type] Enhancement
    Needs Design Feedback
    Needs Dev
    on Oct 16, 2019
  2. shaunandrews commented on Dec 10, 2019

    @shaunandrews
    Contributor

    I don't have a big problem with the empty popover, but maybe adding a "(no URL)" label could help:

    image

  3. joyously commented on Dec 10, 2019

    @joyously

    I don't have a problem with how it works now either, except that there is no part of the UI to make an anchor instead of a link.

  4. shaunandrews commented on Dec 10, 2019

    @shaunandrews
    Contributor

    there is no part of the UI to make an anchor instead of a link.

    You just type the anchor into the input field, like this:

    image

  5. joyously commented on Dec 10, 2019

    @joyously

    You just type the anchor into the input field

    That makes a link, not an anchor. You don't use a href on an anchor, you use the ID attribute. It's a destination, not a way to get there.

  6. shaunandrews commented on Dec 10, 2019

    @shaunandrews
    Contributor

    Ah, I see what you mean now. I've never used a link as an anchor point — only to link to one. Currently, Gutenberg allows you to add an ID anchor to the Heading block — which is the only way I've ever done it.

  7. mapk commented on Apr 14, 2020

    @mapk
    Contributor

    I just tested this out by creating an empty anchor in the code editor. While we have a new LinkControl component, we just show an icon now with no text. Is this still a problem?

    Screen Shot 2020-04-14 at 9 29 01 AM

  8. gziolo commented on Apr 15, 2020

    @gziolo
    MemberAuthor

    I tested it with the Classic block and it looks like the way it's handled there is, it gets never converted into a link if you leave the input field empty. In the case where you remove the URL and save it, it works as if you would remove the link. We should replicate the same behavior.

    I guess the motivation in the Classic editor was to avoid creating an anchor that is invalid because it doesn't have src defined. However, you could argue that it might have id (name in the past) attribute and be valid as well. It's probably up to the accessibility team to advise what's the best way to move forward.

  9. mapk commented on Apr 30, 2020

    @mapk
    Contributor

    @enriquesanchez, can you provide some accessibility feedback on this one?

  10. added
    Needs Accessibility Feedback
    and removed
    Needs Design Feedback
    on Apr 30, 2020
  11. enriquesanchez commented on Apr 30, 2020

    @enriquesanchez
    Contributor

    I think we should communicate that the link contains an empty href attribute.

    That can be something like adding the text "This link is empty". We should also remove the visually hidden "(opens in a new tab)" and the SVG icon.

    Frame 5

  12. removed
    Needs Accessibility Feedback
    on Apr 30, 2020
  13. joyously commented on May 1, 2020

    @joyously

    To me, "link is empty" means there is no text to click. Perhaps "address is empty" or "no destination"?

    What is the procedure for making an anchor (no href)?

  14. skorasaurus commented on May 3, 2021

    @skorasaurus
    Member

    related: #26351

  15. gziolo commented on Sep 15, 2021

    @gziolo
    MemberAuthor

    @getdave, should we close this issue after all the iterations applied to the URL link tooltip?

  16. getdave commented on Sep 15, 2021

    @getdave
    Contributor

    @gziolo I can see the same issue still occurs, namely that the Link UI doesn't expect this scenario and the UX is non-optimal.

    Screen Shot 2021-09-15 at 09 43 06

    Screen Shot 2021-09-15 at 09 42 53

    Therefore I don't think we should close this one but instead I think we should re-do the description to ensure it's up to date with the changes in the codebase.

    @javierarce You and I have worked on the link UI quite a bit. How do you think we should communicate to the user that there is no link or it is invalid?

    @gziolo Would you agree an empty href should be considered an "error" state?

  17. gziolo commented on Sep 15, 2021

    @gziolo
    MemberAuthor

    Would you agree an empty href should be considered an "error" state?

    I guess it's a correct assumption. We should show some hints to the user so they could fix it.

  18. javierarce commented on Sep 15, 2021

    @javierarce
    Contributor

    @getdave I think #17972 (comment) is still a good solution but we could change the icon:

    image

    I also notice that it's possible to create empty links by inserting a space in the input field and the control will create an empty link with just the string http://.

  19. getdave commented on Sep 16, 2021

    @getdave
    Contributor

    This task is now on my radar to be worked on when I can.

  20. added
    [Status] In Progress
    on Sep 22, 2021
  21. added
    [Feature] Link Editing
    and removed
    Needs Dev
    on Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] Link Editing[Package] Block editor[Status] In Progress[Type] Enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions