-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Insert link: the link selection disappears when entering a link #6156
Comments
I tested using WordPress 4.9.7 and Gutenberg 3.3.0 and confirmed that, if I select text and click the link icon in the paragraph block, no formatting or highlighting appears to show me what link text is currently selected. Tested with WordPress 4.9.7 and Gutenberg 3.3.0. (screenshot) |
This seems to have regressed in master - reopening the issue. Unsure why the e2e tests didn't catch it. |
Is this to do with the recent |
Yes, the link UI was rewritten without the placeholder link... We can restore that I guess. |
I can look into this, but I'm considering it low priority. Feel free remove my assignment if someone else would like to fix. |
Tbh I wouldn't add a link placeholder before it's inserted. That seems not so clean, we'd have to make sure the link is removed again etc. Would be nice if we could somehow keep the a selection or render a fake selection or something visible around the target. |
@iseulde By fake selection, I'm guessing you mean an element overlayed over the top of the text? I had a look into this idea, and I think it could be a winner. I used a similar approach to positioning the overlay as used in PositionedAtSelection to position the popover. Here's an example of how it looks (it seems to even work for multiple selected lines 🎉, though note the popover isn't particularly well positioned for multiline selections 😢 ): Need to do some cross-browser testing and tidy up the code, but I'll try to have a PR submitted soon if all goes to plan. |
@talldan Yes, that could be a fine approach. Something else we could try is having an internal format |
Clean up isn't an issue with this approach, as the selection renders in the |
Remember that different operating systems style text selection differently, and that users can change their text selection colour: The fake selection would have to be styled in a platform agnostic way. Personally, I think styling the placeholder selection or link as blue underlined text sends the strongest signal that a link is being inserted. |
This is more a "nice to have" than a blocking issue. |
Iframing the content (#21102) will fix this. |
Great! As I see the Site Editor iframe PR has been merged then the work on iframing the Post Editor can also continue. |
Iframing task is complete and merged - and this issue is no longer present in my testing - so I'm going to close this issue. |
Issue Overview
When inserting a link, your text selection disappears when the focus changes into the Paste URL or type text field. This makes it hard to tell exactly what text you are linking.
Screenshots / Video
Steps to Reproduce (for bugs)
Expected Behavior
Your cursor should be in the Paste URL or type text field and there should be a blue selection rectangle around the text that you selected.
Current Behavior
Your cursor is in the Paste URL or type text field but the text you selected is no longer selected.
Possible Solution
The classic editor solves this by immediately inserting a link placeholder, as soon as you create a link:
Related Issues and/or PRs
This was flagged as an issue in #4572 and #5960 (comment). #4909 contained a failed attempt at fixing this.
The text was updated successfully, but these errors were encountered: