Left tab bar wraps each item into a new line on all Wikisource
Closed, ResolvedPublicBUG REPORT

Description

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

  • Go to Polish Wikisource (it's one of the DIP pilot wikis)
  • Pick any page in the main namespace
  • Make sure it's ?safemode=1

What happens?:
The tabs Source and Discussion are displayed in new lines

obraz.png (268×1 px, 37 KB)

What should have happened instead?:
The tabs should be all in one horizontal line

Technical notes
The Proofread page extension uses a non-standard technique to insert links into the page toolbar.
From ext.proofreadpage.article.js#19:

	$( '#ca-nstab-main' ).after(
		$( '<li>' ).attr( 'id', 'ca-proofread-source' ).append(
			$( '<span>' ).html( urlLink )
		)
	);

The extension should use the mw.util.addPortletLink() method to insert these links instead.

Event Timeline

Aklapper renamed this task from Tab bar broken on Polish Wikisource to Left tab bar wraps each item into a new line on Polish Wikisource.Aug 25 2022, 4:40 AM
ovasileva renamed this task from Left tab bar wraps each item into a new line on Polish Wikisource to Left tab bar wraps each item into a new line on all Wikisource.Aug 25 2022, 8:04 AM

Change 826590 had a related patch set uploaded (by Jdrewniak; author: Jdrewniak):

[mediawiki/extensions/ProofreadPage@master] Use mw.util.addPortletLink to attach "source" link

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

I think there was a conversation about moving the addition of this to the server-side, maybe we should do that instead of trying to hack it in this format.

The "Source" tab is a proper peer to "Page" and "Discussion" on Proofread page-based wikis (like the Wikisourcen), so mw.util.addPortletLink() is not an appropriate fix for this problem.

Moving the tab addition to server side is one way (but doesn't that just move the problem around? Is there an actual API for this in PHP?).

The real fix would be to add proper API for adding tabs and menus. That would aid Gadgets as well (cf. MoreMenu, Popups, BigChunkedUpload.js, and any number of other user scripts and Gadgets that need to add UI to this area).

The simple workaround is to update ext.proofreadpage.article.js to account for the changed HTML structure in Vector 2022 (as all the Gadgets and user scripts had to do) and it'll keep working until the next time it changes (sometime around 2032 based on available evidence).

The real fix would be to add proper API for adding tabs and menus.

@Xover indeed! sadly that's slightly out of scope for this ticket, but it's something that @Jdlrobson , @cjming and others are thinking about. There's an associated task T311647 if you'd like to follow that conversation. Until we have such an API in core though, I think we'll have to go with the simple fix.

Change 826590 merged by jenkins-bot:

[mediawiki/extensions/ProofreadPage@master] Use mw.util.addPortletLink to attach "source" link

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

Moving the tab addition to server side is one way (but doesn't that just move the problem around? Is there an actual API for this in PHP?).

This should be done on the server side and can be done on the server side. I'll take a look at that.

Change 828036 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/ProofreadPage@master] Source tab should be server side rendered

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

Moving out of sprint board as this is no longer a desktop improvements problem. I've suggested a better long term solution which avoids the reflow caused by the existing JS mechanism.

Jdlrobson raised the priority of this task from High to Needs Triage.Aug 30 2022, 3:17 PM

Change 832705 had a related patch set uploaded (by Tpt; author: Tpt):

[mediawiki/extensions/ProofreadPage@master] Drops JS-side creation of "Source" link

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

Change 828036 merged by jenkins-bot:

[mediawiki/extensions/ProofreadPage@master] Source tab should be server side rendered

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

Looks great! Please reopen if anything more is needed here