Page MenuHomePhabricator

CX2: Preview existing pages for the selected text
Closed, ResolvedPublic

Description

When translating an article users may need more information about a word to do a better translation. Surfacing a wikipedia article if such exists for the selected piece of content allows translators to quickly check the meaning of such word, and read the article to understand how related concepts about the topic are captured in the local language.

This ticket proposes to show a preview card when the user selects some text for which an article exists. That will help to surface the information in the tools panel, making it available for users to access it if they are interested in it, but not getting in their way if they were not (e.g., they may just want to delete or rewrite the selection).

The preview card will anticipate two of the common actions users do in these cases:

  • Open the article. Users can open the article in a new tab/window. This saves time they would spend searching manually for it on their own.
  • Adding a link to it. Providing a shortcut to quickly creating a link in one click, encourages to keep information connected.

The idea is illustrated below:

Interaction with links
If the selected element in the content is is already a link (selected by clicking on it or making a text selection that includes it), the usual link card will be shown (T168290). In this case, the page previewed will be the one the link is pointing to (i.e., not based on the label).

Design details
The design of the card will follow the specifications from T168290.


Note that the page preview card may not be the only information shown for the selected text. Other cards may show more information such as definitions from a dictionary, or alternative corrections from the Machine Translation service.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 29 2018, 10:05 AM
Pginer-WMF triaged this task as High priority.Mar 29 2018, 10:06 AM
Pginer-WMF updated the task description. (Show Details)Mar 29 2018, 10:37 AM
santhosh claimed this task.Apr 27 2018, 8:01 AM
santhosh removed santhosh as the assignee of this task.
santhosh claimed this task.
santhosh moved this task from Priority backlog to In Progress on the Language-2018-Apr-June board.
santhosh added a subscriber: santhosh.
Pginer-WMF updated the task description. (Show Details)Apr 27 2018, 10:15 AM

Change 430357 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/extensions/ContentTranslation@master] WIP: CX2: Adjust the design for link cards

https://gerrit.wikimedia.org/r/430357

Change 430357 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] CX2: Adjust the design for link cards - Part 1

https://gerrit.wikimedia.org/r/430357

QA note: Please see T194654: Missing sentence highlighting and text selection context item for a known unresolved issue. If not other issues are found in testing, this can be moved to Done.

The link card is not showing the correct article in the source language.

the main article in the card should be based on searching for the title of the selected text in the target wiki. However, the source article (shown at the bottom of the card), should be the equivalent of the target article, based on Wikidata not on title coincidence.

In the example below I'm translating from English to Spanish, and I selected "tierra" the Spanish for "Earth". I'd expect to see Tierra and Earth. Currently I got a source link to Tierra instead.

(example based on translating "Plants in Space" from Spanish to English)

Etonkovidova added a subscriber: Etonkovidova.EditedMay 16 2018, 9:57 PM

@Pginer-WMF

(1) I tried to see the issue that you've reported above, but translation of "Plants in space" from English to Spanish is locked cause you're currently doing it. Btw, there is an article "Tierra" in enwiki - and it's a disambiguation page, so potentially there should be more examples like that.
I found another example when the shown link is to the page 'Primer' just because the word "primer" in Spanish was used:

Interesting that when translating the link to Earth, the link will be to "Earth" not to "Tierra" - so, for links the logic works fine:

(2) Attempts to add links for translation to Catalan will stop at the first letter:


The same case for German (machine translation is disabled):

(3) Adding links to translation where Yandex is supposed to be enabled - not possible.

Change 434670 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/extensions/ContentTranslation@master] Links: Fetch the title pair from source language wiki for text selection

https://gerrit.wikimedia.org/r/434670

Image showing correct source title identification for the selected text

Change 434670 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Links: Fetch the title pair from source language wiki for text selection

https://gerrit.wikimedia.org/r/434670

Remaining:
The selection works by double click, but not by shift+cursor movement+select character one by one. If this kind of selection is used, just the first character is used for link card. This need to be addressed

From a test in CX2 servers I found some other aspects missing:

  • The label for the main action in the card should be "Add" instead of "Add link".
  • Once the user clicks on the "add" action, the link should be created directly. Currently the page search step is shown, requiring one extra confirmation.
  • Once the link is created, the link card should be shown for it with options to edit and remove. Currently the card shows the "add" option still despite the link already being added.

These issues are illustrated below:

Pginer-WMF added a subscriber: Esanders.

Remaining:
The selection works by double click, but not by shift+cursor movement+select character one by one. If this kind of selection is used, just the first character is used for link card. This need to be addressed

Related to this issue, @Esanders added some details in T198644:

The issue here is contextChange events are only fired in certain circumstances, e.g. when the cursor moves into a differently annotated selection, or the selection goes from collapsed to not-collapsed. The only way the tool works as-is is if the word is selected in one action, e.g. by double clicking.

We would not want to increase the number of contextChange events fired (as this could negatively affect performance), so you probably want to change the widget to operate independently of the context system, and listen to surface selection change events.

(if a separate ticket is preferred, we can reopen T198644)

santhosh removed santhosh as the assignee of this task.Aug 28 2018, 7:15 AM

Testing recently I found issues when selecting by clicking + dragging the cursor to select a word. I show a sequence with the example:

  1. I selected the "Apple" segment from the "d'Apple" text by clicking and dragging the selection, but got "A" as suggested page:

  1. Clicked on "Add link", and the document scrolls to top, where the link is not visible (T198471):

  1. After selecting the right page for the link, the link is added but the wrong link card is shown. It is suggesting to add a link (probably because of the selected text), where it should be showing the information of the link I just inserted:

Testing recently I found issues when selecting by clicking + dragging the cursor to select a word. I show a sequence with the example:

  1. I selected the "Apple" segment from the "d'Apple" text by clicking and dragging the selection, but got "A" as suggested page:

Previous comment on this ticket explains that selecting character by character is not working properly - T191007#4255905

  1. After selecting the right page for the link, the link is added but the wrong link card is shown. It is suggesting to add a link (probably because of the selected text), where it should be showing the information of the link I just inserted:

You had selected "Apple", but "Add link" card suggested only adding "A" (like explained in 1.). After clicking to "Add link", link inspector opens and you select "Apple Inc" from the dropdown. At that point, VE code tries to determine if there is any card that should be displayed for the selected context, and now whole word "Apple" is suggested, and not only "A".
Instead of all these things happening in the link addition workflow, you should have "Apple" suggested initially (instead of "A") and clicking "Add link" should add the link immediately. T195064 captures the problem of link inspector opening when "Add link" is clicked and "A" being offered seems to be part of this ticket, as it isn't captured elsewhere.

Testing recently I found issues when selecting by clicking + dragging the cursor to select a word. I show a sequence with the example:

  1. I selected the "Apple" segment from the "d'Apple" text by clicking and dragging the selection, but got "A" as suggested page:

Previous comment on this ticket explains that selecting character by character is not working properly - T191007#4255905

Not sure if it makes a difference but the comment you point to refers to "shift+cursor movement" which I interpret as using the keyboard arrow keys. In my later example I just used the mouse to select the text by pressing the button and dragging to make a selection. Both may be solved with the same fix, but I wanted to point these two different test cases in case there is a difference.

Change 470182 had a related patch set uploaded (by Petar.petkovic; owner: Petar.petkovic):
[mediawiki/extensions/ContentTranslation@master] Update link suggestion after selection change

https://gerrit.wikimedia.org/r/470182

Change 470182 merged by jenkins-bot:
[mediawiki/extensions/ContentTranslation@master] Update link suggestion after selection change

https://gerrit.wikimedia.org/r/470182

(1) There is an additional functionality in the link inspector that I am not sure if it's been descibed, at least, it's not described in this ticket, - 'Change label' - clicking on it does not do anything:

(2) There are some steps in applying a link that, as @Pginer-WMF, pointed out before, probably are redundant.

a) select a word - if an article exists, a link card with the suggested article will be displayed with the inviting 'Add link'.
b) clicking on 'Add link' will display drop-down list of suggestions
c) selecting a suggestion will display again the link card with 'Add link' option, although the link has been added already

Yes, there is 'Done' button displayed in step b), but it's not too obvious that the link has been selected and added.

Inserting a link (via VE insert link) is much shorter.

(3)
The following it's not done

@Pginer-WMF
The label for the main action in the card should be "Add" instead of "Add link".

In my opinion since the action is essentially about adding a link - so it seems to be fine to use "Add link".

To suimmarize:
(1) needs to be sorted out
(2) might be in another ticket - e.g. improving the preview link functionality etc
(3) is minor

To summarize:
(1) needs to be sorted out
(2) might be in another ticket - e.g. improving the preview link functionality etc
(3) is minor

The card that you see in (1) is supposed to be replaced with the other one, as specified in T168290. "Change label" button will be completely gone.

(2) is captured in T195064, which has an active patch to add link immediately after clicking "Add link". The same patch solves (1).

(3) is not completed, but IMO "Add link" is a better label compared to just "Add".

Etonkovidova closed this task as Resolved.Nov 2 2018, 6:05 PM

Thanks, @Petar.petkovic - I reciewed T168290 - the link card with "Change label" is present now in production VE (and, of course, CX2). To improve/remove Link cards elements it's out of the scope for this ticket, anyway.

Since outstanding issue for this ticket is captured in T195064: CX2 - Selecting an option from 'Add link' selection does not update a link card. and the overall current behavior is acceptable, I am closing the ticket as 'Resolved'.