Page MenuHomePhabricator

InputBox button not stylized in live preview
Closed, ResolvedPublicBUG REPORT

Description

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

  • Start editing a page
  • Replace the content with <inputbox>type=create</inputbox> or <span class="mw-ui-button">Foo</span>
  • Click "Preview" on the 2010 toolbar or (if live preview is enabled in Preferences) "Show preview"

What happens?:
The button is not stylized.

What should have happened instead?:
The button appears as it would after saving.

Other information (browser name/version, screenshots, etc.):
Running mw.loader.load('mediawiki.ui.button') in browser console makes the button appear as expected.

Event Timeline

I would guess this is because LivePreview is not adding required TemplateStyles to the page?

I would guess this is because LivePreview is not adding required TemplateStyles to the page?

No. When saved, the buttons are styled by the module mediawiki.ui.button, not TemplateStyles. It's because the parse API is not returning the required module.

matmarex subscribed.

It's surprising to me, but I think this never worked (it's not a regression). InputBox does not add this module (even though it adds others). It works on normal page views, because MediaWiki loads it.

Change 963851 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/InputBox@master] Add missing 'mediawiki.ui.button' module

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

It's surprising to me, but I think this never worked (it's not a regression). InputBox does not add this module (even though it adds others). It works on normal page views, because MediaWiki loads it.

Then shouldn't the live preview do the same? Your patch wouldn't style the manual <span class="mw-ui-button">Foo</span> type, e.g. Template:Clickable button.

Or rather, shouldn't the parse API add the module mediawiki.ui.button if the text includes an element with mw-ui-button?

Maybe, but this has been supposedly deprecated since 1.26, so I don't want to add it to more places. The live preview is a way to discover things relying on that deprecated feature, and I like that.

It's surprising to me, but I think this never worked (it's not a regression).

It did use to work. InputBox definitely, but I think wikitext <span class="mw-ui-button"> as well. Maybe the edit interface itself used to have some MediaWiki UI elements, causing the module to be loaded on page load, without previewing anything?

Maybe, but this has been supposedly deprecated since 1.26, so I don't want to add it to more places.

A few weeks ago this ResourceLoader module has also been deprecated. Wikitext usage has no replacement yet, but it’s being worked on: T346469: Is codex-search-styles stable for templates to use? What should templates do going forward?. We should make sure that that replacement works with live/realtime preview instead of fixing the deprecated one.

The live preview is a way to discover things relying on that deprecated feature, and I like that.

Actually, I’m not sure if this is in general a good attitude. Before the introduction of realtime preview, I would’ve agreed, as live preview is an opt-in and relatively little-known feature, but realtime preview is a default feature available to anyone (including anonymous users) without changing their preferences, so I wouldn’t treat realtime preview as a way to keep reminding us of issues, but a production feature that should just work. (In this specific case, though, I’d say it’s okay to leave a deprecated feature broken for the time being.)

Change 963851 merged by jenkins-bot:

[mediawiki/extensions/InputBox@master] Add missing 'mediawiki.ui.button' module

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

It did use to work. InputBox definitely, but I think wikitext <span class="mw-ui-button"> as well. Maybe the edit interface itself used to have some MediaWiki UI elements, causing the module to be loaded on page load, without previewing anything?

Oh yeah, probably, or maybe some extension that loads stuff on every page.

A few weeks ago this ResourceLoader module has also been deprecated. Wikitext usage has no replacement yet, but it’s being worked on: T346469: Is codex-search-styles stable for templates to use? What should templates do going forward?. We should make sure that that replacement works with live/realtime preview instead of fixing the deprecated one.

Don't hold your breath waiting, I proposed a replacement 8 years ago and it wasn't accepted. https://gerrit.wikimedia.org/r/c/mediawiki/core/+/249453

The live preview is a way to discover things relying on that deprecated feature, and I like that.

Actually, I’m not sure if this is in general a good attitude. Before the introduction of realtime preview, I would’ve agreed, as live preview is an opt-in and relatively little-known feature, but realtime preview is a default feature available to anyone (including anonymous users) without changing their preferences, so I wouldn’t treat realtime preview as a way to keep reminding us of issues, but a production feature that should just work. (In this specific case, though, I’d say it’s okay to leave a deprecated feature broken for the time being.)

I didn't realize realtime preview has been enabled for everyone, that's nice. I agree with you then.