Page MenuHomePhabricator

Clicking [ or ] surrounding a reference throws an error when trying to present the reference drawer
Closed, ResolvedPublic


When you click the [ or ] of a reference you get an error, because the click handler assumes that you clicked the link, not the surrounding brackets

function showReference( ev, drawer, page ) {
		var urlComponents,
			$dest = $( ),
			href = $dest.attr( 'href' );


		// If necessary strip the URL portion of the href so we are left with the
		// fragment
		urlComponents = href.split( '#' );

^^ will be text node '[ '. causing href var to be undefined|null causing an error when trying to .split() it.


*See JS error

Event Timeline

Jdlrobson triaged this task as Medium priority.May 30 2017, 7:10 PM

@TheDJ can you give a page/browser and example? all the '[' I see are children of the link. I can't seem to replicate this.

See betalabs

<a href="#cite_note-Kirkland_geol_pp.21.E2.80.9350-58"><span>[</span>58<span>]</span></a>

The target will be the span, instead of the parent a element. This is because beta has a different configuration for rendering that element:

Not sure how many wiki's in production have non-standard configs like that...

Change 356301 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/extensions/MobileFrontend@master] Use currentTarget rather than target in ref link click handler

Change 356301 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Use currentTarget rather than target in ref link click handler

I'm pretty confident about this change, but can you do a quick review of functionality relating to references to check this hasn't broken anything related?

I did a quick review using an iphone 7+, a Pixel, and a Nexus 4

I used the dog article on beta:

Clicked through the references. Everything worked.