Page MenuHomePhabricator

Add tooltip to elements indicating a moved paragraph
Closed, ResolvedPublic

Description

Motivation
After the wikidiff2 patch is merged, a arrow/"move indicator" indicates when a paragraph has been moved. This is a new UI element in the diff context and we should give users all help we can think of to understand it easily

Task
Add a tooltip to the arrow/"move indicator". When the arrow/"move indicator" is hovered, a tooltip appears that says Paragraph was moved. Click to jump to new location

Event Timeline

Wording "Paragraph was moved" is fine with me.
I slightly changed the task description, from unicode arrow to arrow/"move indicator" – in case we need to chose another symbol and/or another implementation than unicode.

Tobi_WMDE_SW renamed this task from Add tooltip to unicode arrow indicating a moved paragraph to Add tooltip to elements indicating a moved paragraph.Oct 17 2017, 2:30 PM
Tobi_WMDE_SW reopened this task as Open.
Tobi_WMDE_SW removed jkroll as the assignee of this task.
Tobi_WMDE_SW moved this task from Done to Todo on the WMDE-TechWish board.

So my current idea to solve this would be:

  • Adding some JS that looks out for the classes indicating a move paragraph in the wikidiff2 output.
  • The JS runs wherever a diff is present and then dynamically adds a translatable title attribute to the tags there.

Question is:
Where to put the code?

  • Should I just add a new file in resources/src/mediawiki/ something like mediawiki.diff.js? There I would then add code that hooks into mw.hook( 'wikipage.diff' )
  • Or somewhere else? :-)

Ping @Addshore @daniel

Paragraph was moved. Click to jump to new location

So if I see this right, there must be two variants Click to jump to new location and Click to jump to old location. Or do we just stick with Paragraph has moved.?

@Lea_WMDE

Ideally we would have jump to new and jump to old. Would that be possible or considerably more work?

Lea_WMDE changed the task status from Open to Stalled.Nov 2 2017, 9:14 AM
Lea_WMDE triaged this task as Medium priority.
Lea_WMDE changed the task status from Stalled to Open.Nov 3 2017, 11:00 AM

Why do we need JS to add a tooltip? How about just using plain HTML?

The wikidiff2 could emit a placeholder that gets replaced by the localized message with simple search&replace.

D'oh! Yeah your right, we do not necessarily need JS for that. Somehow I thought "parsing" HTML the output of wikidiff2 and doing things there is kind of ugly.

Since we have special CSS classes for the moved paragraph indicators these could be sufficient as "placeholder" but I guess it's better to separate these things...

@Lea_WMDE we would need another change to the C++ library introducing the placeholder then. If you give the go, I would file a ticket for that.

D'oh! Yeah your right, we do not necessarily need JS for that.

If I remember it right from month back when we already discussed this once, this was more an architecture/coupling question to do it or not to do it: "Putting out HTML via C++ makes it hard to change and hard to reason where this comes from, so it should be kept to a minimum" would be one hypothesis that spoke against need-to-be-translated tooltips in HTML.

If I remember it right from month back when we already discussed this once, this was more an architecture/coupling question to do it or not to do it: "Putting out HTML via C++ makes it hard to change and hard to reason where this comes from, so it > should be kept to a minimum" would be one hypothesis that spoke against need-to-be-translated tooltips in HTML.

That's only true for the HTML returned directly by the C++ library. But the output of the lib is called by PHP code in core so we could add more logic there and alter the original output. And PHP in core is at least more easy to adjust then the C++ lib. That's something we did not really took into consideration the last time.

Change 392004 had a related patch set uploaded (by WMDE-Fisch; owner: WMDE-Fisch):
[mediawiki/core@master] Add localised tooltips for moved paragraph indicators

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

Change 392004 merged by jenkins-bot:
[mediawiki/core@master] Add localised tooltips for moved paragraph indicators

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