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

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

Closed
Tracked by #35073
gziolo opened this issue Oct 16, 2019 · 16 comments · Fixed by #35043
Closed
Tracked by #35073

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

gziolo opened this issue Oct 16, 2019 · 16 comments · Fixed by #35043
Assignees
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@gziolo
Copy link
Member

gziolo commented Oct 16, 2019

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.
@gziolo gziolo added [Package] Block editor /packages/block-editor [Type] Enhancement A suggestion for improvement. Needs Design Feedback Needs general design feedback. labels Oct 16, 2019
@gziolo gziolo added the Needs Dev Ready for, and needs developer efforts label Oct 20, 2019
@shaunandrews
Copy link
Contributor

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

image

@joyously
Copy link

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.

@shaunandrews
Copy link
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

@joyously
Copy link

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.

@shaunandrews
Copy link
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.

@mapk
Copy link
Contributor

mapk commented Apr 14, 2020

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

@gziolo
Copy link
Member Author

gziolo commented Apr 15, 2020

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.

@mapk
Copy link
Contributor

mapk commented Apr 30, 2020

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

@mapk mapk added Needs Accessibility Feedback Need input from accessibility and removed Needs Design Feedback Needs general design feedback. labels Apr 30, 2020
@enriquesanchez
Copy link
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

@enriquesanchez enriquesanchez removed the Needs Accessibility Feedback Need input from accessibility label Apr 30, 2020
@joyously
Copy link

joyously commented May 1, 2020

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)?

@skorasaurus
Copy link
Member

related: #26351

@gziolo
Copy link
Member Author

gziolo commented Sep 15, 2021

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

@getdave
Copy link
Contributor

getdave commented Sep 15, 2021

@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?

@gziolo
Copy link
Member Author

gziolo commented Sep 15, 2021

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.

@javierarce
Copy link
Contributor

javierarce commented Sep 15, 2021

@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://.

@getdave
Copy link
Contributor

getdave commented Sep 16, 2021

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

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Sep 22, 2021
@getdave getdave added [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) and removed Needs Dev Ready for, and needs developer efforts labels Sep 22, 2021
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) [Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants