Page MenuHomePhabricator

Auto-collapsed templates displace anchor tag targets
Closed, DuplicatePublic

Description

Reported by @Legoktm. To reproduce:

  1. Navigate to a page that has auto-collapsing templates near the top of the page, such as WP:ANI.
  2. Use the table of contents to navigate to a section partway down the page.
  3. Reload the page.

Expected outcome: upon being reloaded, the viewport is focused on the selected section.

Actual outcome: the viewport is slightly offset.

I can reproduce this in both Chrome 47 and Firefox 40 on OS X.


See also: https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_%28technical%29&oldid=679056994#Section_link_malfunction

Event Timeline

ori created this task.Aug 29 2015, 12:39 AM
ori updated the task description. (Show Details)
ori raised the priority of this task from to Needs Triage.
ori added subscribers: ori, Legoktm.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 29 2015, 12:39 AM
ori updated the task description. (Show Details)Aug 29 2015, 12:41 AM
ori set Security to None.
Legoktm updated the task description. (Show Details)Sep 2 2015, 6:04 AM
TTO added a subscriber: TTO.
Oliv0 added a subscriber: Oliv0.Sep 3 2015, 10:40 AM

This is maybe a different description which could be considered a different bug but: (both with Firefox 38 under Linux Mageia 4 and with Firefox 40 under Windows 10)

  • when I click on the "See also" link in the description above to display it in a new tab, and just as Mandruss describes inside that link, I am taken to a place in the page several screens lower than the "Section link malfunction" section,
  • the same thing happens when I reload the page with Ctrl-R, the only difference is that it can be seen better that the page is first taken to the right place for half a second and then to a different place (when opening a new tab this can be seen only sometimes),
  • if from that place I use Ctrl-L to focus on the address bar and I press Enter, I am taken to the right place.

I've also been seeing the same issue as Oliv0 for a while.

@Jdlrobson: which tags or project does the reading team use to stay abreast of such issues?

Sounds like whatever does the collapsing needs to refresh the hash. e.g.

tmp = window.location.hash;
window.location.hash = '#';
window.location.hash = tmp;

We do this on MobileFrontend after collapsing sections. What code does that collapsing for Vector - mw.collapsible - or is this done via a site script?

I'd suggest adding skin projects to the card e.g. Vector and Monobook (side note we really should have more projects for mediawiki core given it is so big - a #MediaWiki-skins or #MediaWiki-js would be great here)

TTO added a comment.Sep 27 2015, 7:38 AM

We do this on MobileFrontend after collapsing sections. What code does that collapsing for Vector - mw.collapsible - or is this done via a site script?

As best as I can tell, it is a RL module called jquery.makeCollapsible. There is also some nasty old NavFrame trickery in enwiki's Common.js which might need to be looked at.