Page MenuHomePhabricator

Login should return to article including section/hash fragment
Open, MediumPublic

Description

When you browse Wikipedia (English, German, etc.) as a visitor (=not logged in) and click on an entry in the table of contents you get forwarded to an HTML anchor. When you then want to log in to your account you scroll up and click on "Log in" on the upper right corner. MediaWiki redirects you to the log in page. In the URL of the log in page is a parameter called "&returnto=", which redirects you to the previous page after a successful login. But this only redirects you to the previous web page and not to the exact position with the HTML anchor.

Example:

I browse
https://en.wikipedia.org/wiki/Portal_talk:Mathematics#Quantity_and_number
and click on "Log in". Then I get redirected to
https://en.wikipedia.org/w/index.php?title=Special:UserLogin&returnto=Portal+talk%3AMathematics

But the "&returnto=Portal+talk%3AMathematics"-parameter is missing the HTML anchor tag "#Quantity_and_number".
So instead of being redirected to the following page (current status):
https://en.wikipedia.org/w/index.php?title=Special:UserLogin&returnto=Portal+talk%3AMathematics
it would be better if I was redirected to the page with the HTML anchor tag (solution):
https://en.wikipedia.org/w/index.php?title=Special:UserLogin&returnto=Portal+talk%3AMathematics%23Quantity_and_number

In my opinion this should be fixed and the parameter "&returnto=" should use the HTML anchor tag of the previous web page.

I hope you can understand what I see as the problem. If you have any questions just ask me.

Related Objects

Event Timeline

Fixing this would involve detecting when the user clicks on a login link, stashing the fragment, detecting when the login has finished and restoring the fragment (all that on the client side since the fragment is never sent to the server). For storing we could use either sessionStorage or change the link and add returntoanchor=... (the latter is slightly simpler as restoring becomes trivial).

Restricted Application changed the subtype of this task from "Deadline" to "Task". · View Herald TranscriptDec 12 2018, 4:18 AM
Restricted Application added a subscriber: Gilles. · View Herald Transcript

I don't think this is universally considered an issue.

Given the layout of our current skins (Vector, MonoBook, Minerva, ..) the login link is at the top of the page. This means the only way you can press it, is if you were at the top of the page. The log in link is returning you to that state, exactly where you were before clicking the link.

While it's certainly possible that a user follows a link to a section, and then immediately wants to log in (as Soluvo describes), it's also quite possible you started at a different section and have actually started reading the page normally and only later decide to log in. At this point, your address bar will still point to the section where you started, not where you are. Returning to user to a section they were three or four cognitive progressions in the past, is not expected or desirable, I think.

We may want to analyse this from a product and user story perspective. What's the larger story / intention?

@Soluvo Is your intention to edit the section you were reading, but want to be logged-in first? If so, perhaps an approach could be to make it easier to log in as part of the edit process. E.g. "edit section" -> editor loads and you're encouraged to login -> continue editing.

As a workaround, one could probably log in in a separate tab and then refresh - that's usually the thing to do if you need to log in without losing where you are (or any unsaved work).

@Soluvo Is your intention to edit the section you were reading, but want to be logged-in first? If so, perhaps an approach could be to make it easier to log in as part of the edit process. E.g. "edit section" -> editor loads and you're encouraged to login -> continue editing.

Yes, that's right, my intention is that I want to edit the section that I am reading or was directed to (including the HTML anchor tag), but I want to be logged-in first.

As a workaround, one could probably log in in a separate tab and then refresh - that's usually the thing to do if you need to log in without losing where you are (or any unsaved work).

Yes, that's a very good workaround. I will use this approach in the future. Thanks!

IP masking introduced the returntoanchor parameter for action=edit. At this point it's probably better to consistently handle it than to sometimes handle it.

Bugreporter2 subscribed.

I don't think this is necessary.

Krinkle renamed this task from When logging into Wikipedia, Mediawiki redirects one to the previous webpage but without the HTML anchor tag to Login should return to article including section/hash fragment.Sun, May 17, 10:37 PM
Krinkle updated the task description. (Show Details)