Page MenuHomePhabricator

Inline links to audio in Reference Previews should not open their media page
Open, LowPublicBUG REPORT

Description

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

  • Make sure to disable the Reference Tooltips gadget and enable Reference Previews instead. (Note the gadget shows the same behavior but is tracked separately via T347776.)
  • Open a page that contains an audio link inside a reference, such as Germany on enwiki
  • Hover over the reference (in this case the sup link [e] in the first paragraph)
  • Click the audio button

What happens?:
You get the media page

What should have happened instead?:
The audio plays inline

Event Timeline

Aklapper renamed this task from Inline links to audio don't work in Reference Tooltips to Inline links to audio in Reference Previews should not open their media page.Fri, May 31, 8:49 AM
Aklapper added a project: Reference Previews.
Aklapper updated the task description. (Show Details)
Nardog added subscribers: Lina_Farid_WMDE, thiemowmde, Nardog.

That task is about Reference tooltips, not Refernece Previews.

This is the most minimal example I was able to extract that demonstrates the problem.

<ref><phonos file="De-Deutschland.ogg" /></ref>

MediaWiki-extensions-Phonos renders this as an <a> tag with a href="….mp3" attribute as a fallback for browsers without JavaScript and a mouse click handler for browsers with JavaScript. The Reference Previews code copies the HTML but not the JavaScript handler. This is by design. Reference Previews can't know what it will find in a <ref> and if there are interactions that might or might not make sense in a popup. Remember, the content of a <ref> is essentially a separate wikitext document that can contain literally everything. We really don't want Reference Previews to blindly copy and trigger unknown JavaScript handlers, but only support features that are known to be safe and useful inside of a popup.

That said, I agree "clicking should just play the sound" is one of these features that just make a lot of sense and should be added.

Still I'm lowering the priority because the current behavior is not fundamentally broken. In fact, the sound does play.

Why not fire the wikipage.content hook for the ref content?

Absolutely, thanks. That will certainly be something to look into when we find the time and resources. But it can only work when both sides use the same hook system.

Why not fire the wikipage.content hook for the ref content?

The problem with that solution is that Reference Previews (and Reference Tooltips alike) don't work with the original content of the reference, but clone its contents on demand. So, if there are any transformations done on that hook after page load, they will be done twice which may lead to, say, some text or icons appearing twice.

That said, as a workaround, you could run wikipage.content specifically on .ext-phonos (its parent .noprint to be precise) and hope no other handler does anything with Phonos. But probably we should just use $.fn.on in Phonos at that point.