WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#36637 closed defect (bug) (fixed)

Inline linking inserts `_wp_link_placeholder`

Reported by: walbo Owned by: azaozz
Milestone: 4.5.3 Priority: normal
Severity: normal Version: 4.5
Component: Editor Keywords: has-patch fixed-major
Focuses: javascript Cc:

Description

The text _wp_link_placeholder is inserted into the inline linking.

To reproduce:

  1. Mark some text and click the insert/edit link icon.
  2. Click the insert/edit link icon once more.

The text _wp_link_placeholder is now inserted into the input field. Sometimes you need to press the cmd key to get the text inserted.

Attachments (2)

_wp_link_placeholder.jpg (43.3 KB) - added by walbo 3 years ago.
36637.patch (567 bytes) - added by iseulde 3 years ago.

Download all attachments as: .zip

Change History (18)

#1 @swissspidy
3 years ago

  • Milestone changed from Awaiting Review to 4.5.2

Sometimes you need to press the cmd key to get the text inserted.

I can definitely reproduce this when cmd clicking on the icon twice. Don't even have to select some text.

#2 @iseulde
3 years ago

  • Keywords has-patch added

@iseulde
3 years ago

#3 @azaozz
3 years ago

This is mostly "cosmetic", but annoying nevertheless.

Of course it will create a link with href of _wp_link_placeholder if the user clicks on the Apply button, but that would happen for any text entered in the URL field. Been wondering if we should change that behaviour when the text is obviously not an URL.

#4 @azaozz
3 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 37301:

TinyMCE: prevent showing the placeholder URL when adding a link and clicking more than once on the Insert Link button.

Props iseulde.
Fixes #36637 for trunk.

#5 @azaozz
3 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopen for 4.5.2 consideration.

#6 @askapache
3 years ago

Thats a good start, I have deployed your patch. I think this needs a lot more thinking about from a UX perspective. The dev-side is solid, it seems to me to be a lack of scope and QC from a non-dev perspective. Just my 2c

#7 follow-up: @iseulde
3 years ago

@askapache Could you elaborate?

#8 follow-up: @AUMW-Jay
3 years ago

There's an additional issue, besides the display of _wp_link_placeholder, and that is the inline link tool does not go away. It stays visible, obscuring text until you either reload the page or insert another link elsewhere (perpetuating the non-closing link tool, but further down the page.)

askapache might have others, but some of my UX issues are that the tool adds clicks to the workflow. It now requires two clicks to go to the advanced link area (needed for opening the link in new window/tab, and rel=nofollow checkboxes, versus a single click in the pre 4.5 link editor. The new tool might (if it worked correctly and closed when the link was inserted) be better for some users, but it's made life worse for folks that care about SEO.

update: I found a way to reproduce (and fix the issue) - I use the Rel Nofollow Checkbox plugin on all my sites. Toggling this plugin on/off makes the issue appear or not.

I'm guessing there are other plugins which also trigger the same failure issue.

Last edited 3 years ago by AUMW-Jay (previous) (diff)

#9 in reply to: ↑ 8 @SergeyBiryukov
3 years ago

Replying to AUMW-Jay:

There's an additional issue, besides the display of _wp_link_placeholder, and that is the inline link tool does not go away. It stays visible, obscuring text until you either reload the page or insert another link elsewhere (perpetuating the non-closing link tool, but further down the page.)

Related: #36650

#10 in reply to: ↑ 7 @askapache
3 years ago

Replying to iseulde:

@askapache Could you elaborate?

Well for me personally I don't have trouble getting this to work. The issue is I run a site that has hundreds of non-technical editors who are having a lot of issues with this.

  1. They don't understand how the new tool works, it's not intuitive to a lot of them and so makes them frustrated that something that used to be easy for them now is difficult.
  2. What used to take just 2 clicks now takes several, and they don't see any benefits other than the auto-searching for internal links feature that would make the extra click worth it
  3. This feature should have been built with a simple filter (or even an option in the backend) to disable this, instead it is baked in in a way that makes it impossible to disable without hacking core or going to extremes in a plugin or theme file.
  4. I have had several editors ask me if I could please revert to the old method of linking in the visual editor, it would be great if this was a user configurable option on the profile page that would let them switch back and forth.

All in all, I like the idea, and it works fine for me, and the js code for this is very well-written! It's just a major headache to have to respond to all these backend editors that there is nothing I can do to help them with this.

The only thing I have been able to do is add a filter to replace links to _wp_link_placeholder with links to the siteurl, and I added an error_log statement so that I am manually finding posts with this error, and then contacting editors individually notifying them they need to fix and learn this new way of doing it :(

Here's a simple fix for at least preventing these links from showing up publically.. haven't found a fix for the editors yet.

<?php
function askapache_filter_link_placeholder( $content ) {
        if ( isset( $content[10] ) && strpos( $content, '_wp_link_placeholder' ) !== false ) {
                // remove links to /_wp_link_placeholder by replacing them with WP_SITEURL
                return preg_replace( '#_wp_link_placeholder#', WP_SITEURL, $content );
        }
        return $content;
}
add_filter( 'the_content', 'askapache_filter_link_placeholder' );
add_filter( 'the_content_feed', 'askapache_filter_link_placeholder' );
add_filter( 'get_the_content', 'askapache_filter_link_placeholder' );
add_filter( 'the_excerpt', 'askapache_filter_link_placeholder' );
add_filter( 'content_save_pre', 'askapache_filter_link_placeholder' );
add_filter( 'excerpt_save_pre', 'askapache_filter_link_placeholder' );

And then in robots.txt

Disallow: /_wp_link_placeholder
Last edited 3 years ago by askapache (previous) (diff)

#11 @KPeregrine
3 years ago

I am putting this comment here because Comments #6, #8, #9 and #10 speak to this issue.

Inline link box doesn't go away: Well, it will... but it requires additional mousing. Not user-friendly.

I avoid using the mouse & prefer the keyboard. To create a link I visit the page-to-link and copy the URL (CtrlC). Then I highlight the text in the blog post, mouse-click on the link tool, and paste (CtrlV) the link in the box. To confirm the link I hit Tab and then Enter (instead of mouse-clicking the blue confirmation arrowhead).

Then the inline link box just sits there & will not go away. To make the box go away I must mouse-click on any other place in the blog post. Annoying.

By the way, 90% of my links are external. I don't like chewing up time while WP searches for internal links so I rarely use the settings/options gear. When I do use that option, it's even more mousey that my normal method.

(I don't use any link-related plug-ins)

#12 @ocean90
3 years ago

  • Keywords fixed-major added

#13 follow-up: @adamsilverstein
3 years ago

@KPeregrine thanks for the feedback - I tried using the link editor with only the keyboard and see how the pointer shows up after hitting enter. i was able to close the tip easily though by using any arrow key.

Here is a keyboard only screencast where I add a link, then continue to the right using the right arrow key; note the pointer goes away once I leave the link area:

http://cl.ly/182p1E0N3l0S/Screen%20Recording%202016-05-12%20at%2011.35%20AM.gif

#14 in reply to: ↑ 13 @KPeregrine
3 years ago

Replying to adamsilverstein:

Thanks, adamsilverstein. That works for me!

This ticket was mentioned in Slack in #core by adamsilverstein. View the logs.


3 years ago

#16 @ocean90
3 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 37454:

TinyMCE: prevent showing the placeholder URL when adding a link and clicking more than once on the Insert Link button.

Merge of [37301] to the 4.5 branch.

Props iseulde.
Fixes #36637.

Note: See TracTickets for help on using tickets.