[go: up one dir, main page]

Page MenuHomePhabricator

Interlanguage links not available in live preview with Vector 2022
Open, Needs TriagePublicBUG REPORT

Description

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

  • Disable "Show preview without reloading the page"
  • Start editing a page with language links (Vector 2022, 2010 editor)
  • Click "Show preview"
  • Confirm the button at the top right says "n languages"
  • Enable "Show preview without reloading the page"
  • Start editing a page with language links (Vector 2022, 2010 editor)
  • Click "Show preview"

What happens?:
The language button remains "Add languages".

What should have happened instead?:
The language button changes to "n languages".

Event Timeline

It’s not specific to Vector 2022. I tested all seven skins available on WMF wikis, the results:

So it’s more like an incident that Vector 2010 does work. It looks like live preview makes assumptions about how language links work that hold only in Vector 2010, not even in its closest relatives (Monobook and Modern). I think this is the point where a new API should be introduced, e.g.

/**
 * @param {{href: string, bcp47: string, nativeName: string, tooltip: string}[]} links
 */
mw.util.replaceLanguageLinks(links) {...}

…which can (and should) be implemented by each skin on its own, putting the language links where they belong on that particular skin.

It looks like live preview makes assumptions about how language links work that hold only in Vector 2010.

This is correct. There was no predictable layout (no API contract) in live preview for most elements, so traditionally almost everything that wasn't the actual wikitext would not render. At some point I improved live preview to support more elements, but several of these were only supported on Vector (2010) and it very much depends on the HTML layout.

There has been no effort yet to define a contract for how language links would update in preview

There has been no effort yet to define a contract for how language links would update in preview

Except for my proposal above (granted, it wasn’t that big of an effort…). Is there an official way to propose and discuss such APIs? Given that all skins are expected to implement it, which makes it very hard to fix it afterwards if we get it wrong for the first time, I don’t want to take it light, but I’d like to get it rolling. (And if we’re at it, maybe categories could be fixed as well – they’re currently broken on Timeless because live preview doesn’t account for the fact that Timeless renders categories at multiple places to make the show them at different places at different screen resolutions.)