Page MenuHomePhabricator

If a previewed link to the page itself is opened in a new tab then it shouldn't give an edit page
Open, Needs TriagePublicFeature

Description

If you preview a section link to the page itself then clicking it will go to the edit page itself so the link can be tried in context without reloading the page. That makes sense.
But if you open the link in a new tab or window, e.g. in a section edit where you are trying to test a link to another section, then it means you open a new edit page and the section link doesn't work.
Can something be done about this? For example, attach a certain parameter to such selflinks in previews. If an edit url is loaded with this parameter then ignore the edit part of the url and display the wiki page instead.

The issue can be tested by previewing this on https://en.wikipedia.org/wiki/Wikipedia:Sandbox with the source editor:

== Heading ==
Links to the above heading:
* [[Wikipedia:Sandbox#Heading]]
* [[#Heading]]

Both links work when clicked normally but not when opened in a new browser tab or window which gives me:
https://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&action=submit#Heading

I suggest you instead get https://en.wikipedia.org/wiki/Wikipedia:Sandbox#Heading like if you had previewed the first link from any other page or saved the code before clicking any of the two links. A url variation with the same result would also be fine: https://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox#Heading

Event Timeline

I don't understand this description. Can you clarify it? What steps to reproduce?

To reproduce, use a browser which can open a link in a new tab instead of the tab you are already in, and use the desktop site. Desktop browsers usually have an option like "Open link in new tab" after right-clicking a link. It can usually also be done by holding down Ctrl or Shift while left-clicking the link. In a mobile browser, you may get the option in a menu after pressing the link for a second or two instead of a brief tap.

I have saved the test case.

  1. Click https://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&action=edit&oldid=1304538548
  2. Click "Show preview"
  3. Open the link "Wikipedia:Sandbox#Heading" in a new tab

OK. I understand a bit better now.

You might want to think about editing the task description. The bug-writing guidelines ask you for a step-by-step to describe the problem. Every step ought to be described, even if you think it's trivial. This sort of thing is confusing:

If you preview a section link to the page itself then clicking it will go to the edit page itself so the link can be tried in context without reloading the page.

Anyway, the link on the preview is a canonical URL which has &action=submit appended to it. The next action expected by the user is to submit the edit, so it must be pulling it from this. When really it should be &action=view or just a short URL.