Page MenuHomePhabricator

VisualEditor: Make it hard for users to partially-select some unlinked text for linking
Open, MediumPublic

Description

From bug T35091:

  • The UI of the visual editor should have a change to the user's interaction

with link creation to make it harder to accidentally create things like
<a>foo</a>bar.

I'm not quite sure what the ui change should be. Perhaps something like making
it so that when you try to create a link the selection might be altered to
cover the full word. Something that would require the user to force the editor
to use the selection that would create a <nowiki/> instead of just accepting it
as-is.

Whatever the case, we do not want the user who partially selects a run of text
and turns it into a link to inadvertently create a <nowiki/> when they likely
intended to make a link of the whole thing.

Details

Reference
bz37939

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 12:27 AM
bzimport set Reference to bz37939.

I like the idea of expanding the selection (altering it) to cover the full word, however it still have to be possible to link just a part of the word (not sure how).

(In reply to comment #1)

I like the idea of expanding the selection (altering it) to cover the full
word, however it still have to be possible to link just a part of the word (not
sure how).

Link a whole word then unlink a part?

(In reply to comment #2)

(In reply to comment #1)

I like the idea of expanding the selection (altering it) to cover the full
word, however it still have to be possible to link just a part of the word (not
sure how).

Link a whole word then unlink a part?

It is not very intuitive, but maybe we don't need this particular action to be intuitive.

I would warn about automatic changes here. Partially linked words are a standard feature of Wikipedia, especially to link the singular substring of plural words in languages that generally allow that.

A nice-to-have feature may be to provide a dialogue box asking: "you have only marked a part of the word - do you want to link the entire word?".

I consider this a low priority enhancement however.

(In reply to comment #4)

I would warn about automatic changes here. Partially linked words are a
standard feature of Wikipedia, especially to link the singular substring of
plural words in languages that generally allow that.

A nice-to-have feature may be to provide a dialogue box asking: "you have
only
marked a part of the word - do you want to link the entire word?".

I consider this a low priority enhancement however.

We're talking here about creating links as <a href=Foo>Fooian</a>, and whether or not they convert to "smart" wikitext ([[Foo]]ian) or to the more boring form ([[Foo|Fooian]]). We're not talking about automatic changes - if the link hasn't been edited, it shouldn't be changed.

I don't think that the style of wikitext that people create using the VisualEditor (as opposed to not breaking others' wikitext) is hugely important, but if you want that to be a specific change, you could create a new bug for Parsoid (which is responsible for the HTML->wikitext conversion).

This is specifically about creating a link (to whatever target) on some selection of part of a word, which then on being saved is converted unintentionally. I.e.:

Automobile -> <a href=Automatic>Auto</a>mobile -> [[Automatic|auto]]mobile

… whereas it should end up somehow as [[Automatic|auto]]<nowiki />mobile, or we should stop users for creating it.

I really do not understand (my interaction with this bug was due to searching whether another bug was already reported).

I understand that "[[Automatic|auto]]mobile" will create a link on automobile, whereas "[[Automatic|auto]]<nowiki />mobile" creates a link only on auto.

However, the html conversion should work:
<a href=Automatic>Auto</a>mobile -> "[[Automatic|auto]]<nowiki />mobile"
<a href=Automatic>Automobile</a> -> "[[Automatic|automobile]]"
and
<a href=Auto>Automobile</a> -> "[[Auto]]mobile" (checking for true substring).

If the discussion is about whether to preserve
[[Automatic|auto]]mobile
over
[[Automatic|automobile]]
then I believe it should not be preserved, the first is unnecessarily complicated. These are things that are possible to "clean-up", particularly if, as you plan for the future, you clean-up only those parts that have been edited.

What is the status of this bug? Currently it is not possible to link or unlink part of a word, nor to unlink part of a multi-word link.

I fail to see the purpose of nowikiing the remainder of a partially linked word. If I link "LC circuit" in the string "LC circuits" then I expect the UI to create "[[LC circuit]]s", not "[[LC circuit]]</nowiki>s". That latter behaviour is entirely useless in any normal editing scenario I can think of.

The selection should not be expanded automatically. The UI should assume the editor knows what they are doing unless there is evidence to the contrary. When I make a partial selection like this it means I want the UI to offer "LC circuit" as the link target and display "LC circuits" as the link text.

(In reply to comment #7)

What is the status of this bug? Currently it is not possible to link or
unlink part of a word, nor to unlink part of a multi-word link.

That's a very worrying problem - what browser are you using that makes this impossible? Does it happen on every page? When you say "impossible", do you mean that:

  • the link inspector doesn't open when fired on a partial selection,
  • setting the link on a partial selection doesn't cause a link to be added,
  • on saving the link on the partial selection, it doesn't turn into the expected wikitext, or
  • something else that I've not covered?

I can very much add and remove links to parts of words using the link inspector, and remove parts of existing links using the "clear formatting" button. Hence the issue.

(In reply to comment #8)

I fail to see the purpose of nowikiing the remainder of a partially linked
word. If I link "LC circuit" in the string "LC circuits" then I expect the
UI
to create "[[LC circuit]]s", not "[[LC circuit]]</nowiki>s". That latter
behaviour is entirely useless in any normal editing scenario I can think of.

The selection should not be expanded automatically. The UI should assume the
editor knows what they are doing unless there is evidence to the contrary.
When I make a partial selection like this it means I want the UI to offer "LC
circuit" as the link target and display "LC circuits" as the link text.

That may be what you expect, with your deep understanding of wikitext, but it's very far from how normal visual editors work and so would be very confusing to users who are not immersed in the fine points of link trails.

More fundamentally, making a change in one place that magically affects another is a bad user experience. Why would this magic happen with links but not, say, adding bold? Why would this happen down-word but not up (except on wikis with linkhead instead of/as well as linktrail)? Etc.

(In reply to comment #9)

(In reply to comment #7)

What is the status of this bug? Currently it is not possible to link or
unlink part of a word, nor to unlink part of a multi-word link.

That's a very worrying problem - what browser are you using that makes this
impossible? Does it happen on every page? When you say "impossible", do you
mean that:

  • the link inspector doesn't open when fired on a partial selection,
  • setting the link on a partial selection doesn't cause a link to be added,
  • on saving the link on the partial selection, it doesn't turn into the

expected wikitext, or

  • something else that I've not covered?

I can very much add and remove links to parts of words using the link
inspector, and remove parts of existing links using the "clear formatting"
button. Hence the issue.

The behaviour has changed since the last depot it seems. Currently when using Firefox 22 on Xubuntu Linux:
*Selecting part of a word and pressing ctrl+k means I can link only the selected part (previously ctrl+k was selecting the whole word and then opening the link dialog). This currently works as it should.
*Unlinking part of a word or multi-word link is not possible with the link tool:
If there is the link [[Background]] and I select "ground" and press ctrl+k the selection is changed to "Background" and then the link dialog opens
If there is the link [[Woolwich Arsenal station]] and I select "station" and press ctrl+k the selection is changed to "Woolwich Arsenal station" and then the link dialog opens. (This has not changed since my previous comment)
*Selecting part of a linked word or phrase and removing the formatting does remove the link only on the selection, but also removes any and all other formatting on that selection. Per Bug 51757 this is not desirable.

(In reply to comment #10 and comment #8)
These issues should be solved by making it easy to explicitly set the link and the display text independently and unambiguously in the link dialog as is asked for in bug 50945 and bug 47879

Sorry, that second link should be bug 48789

(In reply to Krinkle)

VisualEditor: Make it hard for users to partially-select some text for linking

VisualEditor: Make it easier to select a link in its entirety (instead of part it)

This isn't actually the bug as filed (or the problem). It's already trivially easy to select an existing link in its entirety (you don't even need to select it); this bug is about when you've made a selection of text which doesn't have a link and are making it into one.

Reverting and making a little clearer.

Jdforrester-WMF lowered the priority of this task from High to Medium.Jan 9 2015, 10:55 PM

I think users wouldn't try to partially-select for linking if [[apple]]s worked with VE.
And one half of fixing that would be to search for "Apple" for links suggestions if "Apples" isn't found.
If the user then selects "Apple" in the suggestions, the correct

<a href=Apple>apples</a> -> "[[apple]]s"

link would be created.

And if "Apple" is found (because a redirect from "Apples" to "Apple"), since it can be detected as a part of "Apples", the correct link can be created too.