[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Page MenuHomePhabricator

Expand toggles in message documentation are inactive when linking to a message directly
Closed, ResolvedPublicBUG REPORT

Description

Steps to Reproduce:

Actual Results:

  • The boxes are closed and cannot be opened (the toggles are inactive).

Expected Results:

  • The box toggles work.

Details:
Issuing

mw.hook('wikipage.content').fire($('.message-desc'));

on the browser console fixes the problem; something like this should be added in the extension’s JS.

Additional note: This seems to happen only when linking to a message directly and not when traversing via the translation list.

Event Timeline

abi_ renamed this task from `wikipage.content` JavaScript hook not fired for TUX documentation to Expand toggles in message documentation are inactive when linking to a message directly.Mar 23 2020, 4:13 AM
abi_ updated the task description. (Show Details)
abi_ subscribed.
resources/js/ext.translate.editor.helpers.js
74:                                     // A collapsible element may have been added
75-                                     $( '.mw-identical-title' ).makeCollapsible();

Maybe this needs to be replaced with the hook? And figure out why it isn't always working.

Sorry, I didn’t check every situation. After some more testing (and using the source look), it’s obvious what happens: {{Identical}} works, because it has mw-identical-title class, but {{Related}} doesn’t (in no case, regardless of how the user got there), because its class is mw-related-title. I think relying on on-wiki classes or any other user-generated content is a Very Bad Thing, and should be avoided if possible. (For example it at least partly works on translatewiki, but doesn’t work at all on WMF wikis.) Here it seems possible with the MediaWiki hook, to which $messageDesc from line 63 can be passed. (I haven’t tested it on a local MediaWiki install, only using the browser console on translatewiki and Commons, where I used $messageDesc = $( '.infocolumn-block .message-desc' ). It’s not the same, but pretty similar, so I think it should work with the code in the extension’s module as well.)

Change 583039 had a related patch set uploaded (by Nikerabbit; owner: Nikerabbit):
[mediawiki/extensions/Translate@master] TUX: Use mw.hook( 'wikipage.content' ) for message documentation

https://gerrit.wikimedia.org/r/583039

Change 583039 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] TUX: Use mw.hook( 'wikipage.content' ) for message documentation

https://gerrit.wikimedia.org/r/583039

This has been deployed to translatewiki.net and can be tested there.

For example, here on the yellow background color is [expand these messages] link generated by Template:Identical, which should always work after this fix.

image.png (898×1 px, 151 KB)

Simlarly for Template:Related, on blue background:

image.png (805×1 px, 160 KB)