Page MenuHomePhabricator

Implement Proper Link Support for WWT
Closed, ResolvedPublic2 Estimated Story Points

Description

As a WWT user, I want to only access links from the revision details pop-out or outside WWT mode, so that links within the article content do not direct me outside of WWT.

Acceptance Criteria:

  • Links in the article content should not work (i.e. they do not redirect users to other pages)
  • Links in the templates should not work (i.e. they do not redirect users to other pages)
  • Links related to multimedia files should not work
  • Links related to the table of contents should work
  • Superscript reference links should work (i.e. existing behavior of linking to the associated reference in the "References" section)
  • Links in the revision details pop-up should work (i.e. they open up in new tabs)
  • If the user clicks any links outside of WWT (such as links in the sidebar), they should be redirected to the new page and WWT will no longer be enabled

Event Timeline

ifried renamed this task from Placeholder: Support Proper Link Support for WWT to Support Proper Link Support for WWT.Sep 3 2019, 4:12 PM
ifried updated the task description. (Show Details)
ifried set the point value for this task to 2.Sep 3 2019, 11:18 PM
ifried moved this task from Needs Discussion to Up Next on the Community-Tech board.
ifried renamed this task from Support Proper Link Support for WWT to Implement Proper Link Support for WWT.Sep 3 2019, 11:54 PM
ifried updated the task description. (Show Details)

@Prtksxna I was thinking about the discussion we had regarding superscript reference.

I have some follow-up questions: Isn't the superscript automatically generated when a reference is created? And couldn't feasibly more than one contributor be responsible for one reference (such as one user editing the reference title left by a previous editor)? If I understand correctly, you were inquiring if the superscript reference itself should be a link or if it should generate a pop-up. If my logic is correct, I think it makes sense to keep it a link. Let me know your thoughts. Thanks!

ifried updated the task description. (Show Details)

Here is the example I had in mind — https://en.wikipedia.org/wiki/User:Prtksxna/citation-test.:

  1. The first user, in this case Prtksxna, writes a sentence and then adds a citation to it - https://en.wikipedia.org/w/index.php?title=User:Prtksxna/citation-test&oldid=914767763
  2. They then add a few more sentences - https://en.wikipedia.org/w/index.php?title=User:Prtksxna/citation-test&direction=next&oldid=914767763
  3. Now the second user, in this case PSaxena (WMF), adds a sentence - https://en.wikipedia.org/w/index.php?title=User:Prtksxna/citation-test&direction=next&oldid=914767821
  4. The second user uses the first user's citation on a sentence that the first user wrote - https://en.wikipedia.org/w/index.php?title=User:Prtksxna/citation-test&direction=next&oldid=914768249

5…6…7 Kind of the same the first user adds a sentence, and the second user adds the first users citation on them.

In this case, hovering over the second and third [1] should show PSaxena (WMF) on WWT, since they are the one who added the ref (note the reference had already been created by Prtksxna and was only reused). This is why I think that clicking on the reference links should give us the pop-up and details on who added it and not take us to the reference itself.

The principle I am using is: if WWT data is available and could be useful we should prioritize that over navigation (in the WWT mode).

Update: We've discussed the options related to superscript reference links. Ideally, WWT would support the use case outlined by @Prtksxna, but the API data doesn't allow us to cover such scenarios. From a technical perspective, our options are either to make the superscript reference links: a) functional (i.e. maintain existing link behavior), or b) non-functional (i.e. no ability to click on links). Between the two options, the first is better, since the user is given more options and useful data. For this reason, we'll go with the first option, and the requirements will be updated accordingly.

How about links to edit sections (the ones next to section titles)? They still work at the moment.

How about links to edit sections (the ones next to section titles)? They still work at the moment.

I think they should continue to work. Even thought it is a link within the article it isn't part of the content and is to activate a tool. Also, per T231508: WWT: Handle behavior with VisualEditor, we'll opening VE even when WWT is active.

PR: https://github.com/wikimedia/WhoWroteThat/pull/49

I've added a scroll-correction, to prevent section headings being obscured by the WWT info bar. Not sure if that's desired, but it was annoying me. Happy to remove it if it's no good.

Most items in this task were already working correctly.

The only other issue I've found was that links in edit summaries in the revision popup weren't opening in new tabs. Note that section links, even if they go to an extant section on the current page, will also open in a new tab. I think this is the only sensible way to handle these, because they don't always go to a valid section (even if we were to link them to the revision in question, there's no guarantee that the section exists; this is how it's done everywhere else edit summaries are shown, I think).

The above PR is ready for review.

dom_walden subscribed.

Acceptance Criteria:

  • Links in the article content should not work (i.e. they do not redirect users to other pages)
  • Links in the templates should not work (i.e. they do not redirect users to other pages)

Yep. Including things like navigation boxes and external links.

Category links at the bottom of the page still work, and open in the same tab. We could consider these as part of the article and want them disabled.

  • Links related to multimedia files should not work

Audio files still play. Videos do not.

Links to other file types I could find do not work.

  • Links related to the table of contents should work

Yep.

  • Superscript reference links should work (i.e. existing behavior of linking to the associated reference in the "References" section)

Yep. And the links that go the other way (the links that jump from the reference to the subscript in the article).

  • Links in the revision details pop-up should work (i.e. they open up in new tabs)

Yep.

  • If the user clicks any links outside of WWT (such as links in the sidebar), they should be redirected to the new page and WWT will no longer be enabled

Yep.

@dom_walden & @Samwilson:

When I tested links in templates, they seemed to (at least sometimes) still work. For example, on this page (https://en.wikipedia.org/wiki/SOLRAD_2). I clicked on " Solar X-Ray," and I was redirected to the https://en.wikipedia.org/wiki/X-ray_astronomy#Stellar_X-ray_astronomy. Was this because it was not only a new page, but it was also a jump within the page (so perhaps the code didn't recognize it in the same way)?

Visual Examples:

Ability to click on the link within a template

Screen Shot 2019-09-25 at 11.40.14 AM.png (713×1 px, 475 KB)

The new page that I'm directed to
Screen Shot 2019-09-25 at 11.42.16 AM.png (712×1 px, 313 KB)

Also: Good catch about Categories! We probably do want those disabled -- but, since that work wasn't in the scope of this ticket, I can add this requirement into a new/small 'general fixes' ticket, if preferred.

Images also seem to still link at times (for example, the top right image for the Melvins page: https://en.wikipedia.org/wiki/Melvins)

@dom_walden & @Samwilson:

When I tested links in templates, they seemed to (at least sometimes) still work. For example, on this page (https://en.wikipedia.org/wiki/SOLRAD_2). I clicked on " Solar X-Ray," and I was redirected to the https://en.wikipedia.org/wiki/X-ray_astronomy#Stellar_X-ray_astronomy. Was this because it was not only a new page, but it was also a jump within the page (so perhaps the code didn't recognize it in the same way)?

I think Moriel's gadget is out of date. Are you using that?

You can use mine. I hope this works for you:

mw.loader.load( 'https://meta.wikimedia.org/w/index.php?title=User:Dom_walden/WhoWroteThat.js&action=raw&ctype=text/javascript' );

@dom_walden Thanks! I updated to your gadget and the behavior is now working as expected. I'm marking this work as Done.