Page MenuHomePhabricator

Search with interwiki prefix ignores an anchor
Open, MediumPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

It goes to https://en.wikipedia.org/wiki/Wikipedia
The same happens if you start at https://commons.wikimedia.org and search w:Wikipedia#History

What should have happened instead?:

It should remember the anchor and go to https://en.wikipedia.org/wiki/Wikipedia#History
A wikilink [[:en:Wikipedia#History]] goes to the section as expected.
If you enter Wikipedia#History in the search box at enwiki itself then the anchor is remembered and it goes to the section as expected.
It's unexpected that the behaviour is different in searches with a prefix.

Event Timeline

This seems to be working on Vector 2022 (where the search bar is in the middle of the page), but not on the older skin.

let's investigate to see if this is UI or backend related.

Gehel triaged this task as Medium priority.Jan 6 2025, 4:30 PM

This seems to be working on Vector 2022

It fails for me in all tested skins and browsers, e.g. logged out with Vector 2022 and Firefox at https://simple.wikipedia.org.

This seems to be working on Vector 2022

It fails for me in all tested skins and browsers, e.g. logged out with Vector 2022 and Firefox at https://simple.wikipedia.org.

my bad, I did not test properly.

I think the issue is in the Title class not propagating the anchor when building the link via GoToInterwiki.

dcausse added a subscriber: Bawolff.

The indirection via Special:GoToInterwiki was added in T122209: Special:Search allows redirects to any interwiki link.
I'm not clear if omitting the fragment was intentional or not, I believe that it might be possible to propagate it but I'm unclear on the consequences.
In the case of local interwiki I think the fragment will be propagated by the browser (if not specified in the Location Header): https://de.wikipedia.org/wiki/Special:GoToInterwiki/en:Wikipedia#History (works for me with firefox)
In the case of external interwiki I think we might have to adapt the splash page to reconstruct it in the link presented to the user (using via javascript?)
Special consideration might have to be made for external interwiki links that already declare a fragment, e.g. https://en.wikipedia.org/wiki/Special:GoToInterwiki/mixnmatch:collection where it might be impossible to propagate the user provided fragment.

Tagging MediaWiki-Engineering & @Bawolff for advise because this is well beyond my level of expertise and might not only affect search.

MSantos subscribed.

@dcausse thanks for raising it to our attention. Could you clarify on what kind of advise you would like to have? Are you planning to do it through a gerrit patch or need guidance before start it?

@MSantos I can certainly attempt to write a patch and continue the discussion in gerrit but perhaps before doing so I wanted to know if:

  • is it on purpose that the fragment is omitted when building the Special:GoToInterwiki from Title#getFullUrlForRedirect()?
  • if not would there be any objections in propagating the Title fragment when building the Special:GoToInterwiki link and if there are any special considerations to take into consideration doing so

Movign to "blocked". We're expecting the Mediawiki team to fix this. Since it's not super high priority, this might not actually be worked on for a long time.