Page MenuHomePhabricator

When clicking on href="#" page unexpectedly reloads (with "tableofcontents" URL parameter appended)
Closed, DeclinedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Go to content page with vector 2022 that have TOC on Thai Wikipedia. This page for example.
  • Create some <a> element with href="#". eg. $('#bodyContent').prepend($('<a href="#">test link</a>'))
  • Click on the newly displayed "test link" link appear on top.

What happens?: The browser will reload the page and tableofcontents={0,1} was appended.

What should have happened instead?: Link should not work and go to the target, as some script will add an action (such as 'mw.util.addPortletLink') by define href as #.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.: With the same test, this appear to be found on euwiki and hewiki too which may related to T302046: Build A/B test bucketing infrastructure for the table of contents.

Event Timeline

PatsagornY renamed this task from The page reload when clicked on some href="#" on thwiki to The page reload when clicked on href="#"..May 18 2022, 3:43 PM
PatsagornY renamed this task from The page reload when clicked on href="#". to The page reload when clicked on href="#".May 18 2022, 3:47 PM
Aklapper renamed this task from The page reload when clicked on href="#" to When clicking on href="#" page unexpectedly reloads (with "tableofcontents" URL parameter appended).May 18 2022, 4:12 PM

This "bug" also happens in pages with TOC, with "href" set as anything, and can also be reproduced through JS code: mw.util.addPortletLink('p-views', mw.util.getUrl(mw.config.get('wgPageName'), {diff: 'cur', oldid: 'prev'}),"Last",'ca-difflast');

Jdlrobson subscribed.

Thanks for the report. This relates to our A/B test code.

ovasileva claimed this task.
ovasileva subscribed.

Thanks for the report. This relates to our A/B test code.

We'll be turning the A/B test off this week, which should fix this issue

ovasileva changed the task status from Resolved to Declined.Jun 7 2022, 4:05 PM