Page MenuHomePhabricator

Allow configuration of the Minerva menu
Open, NormalPublic

Description

Currently the menu contains various links but is not customisable either via MediaWiki:Sidebar or LocalSettings.php

This is due to the limited space available in the menu (it was not designed as a dumping ground for links) and the fact that links are more complex than they are in Vector e.g. they feature an icon/are more limited in how they can be laid out.

It should also be possible for mobile versions of skins (for example ?useskin=vector&useformat=mobile) to invoke these menus if wished)


Version: unspecified
Severity: enhancement
URL: http://lists.wikimedia.org/pipermail/mobile-l/2014-April/006882.html
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=63419

related requests

https://m.mediawiki.org/wiki/Topic:Uiervvqroaxj4ya9

Details

Reference
bz63459

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Jdlrobson removed phuedx as the assignee of this task.Dec 29 2015, 12:23 AM
Jdlrobson moved this task from Ready for Signoff to To Do on the Reading-Web-Sprint-63-Ellip… board.
Jdlrobson renamed this task from Allow configuration of the mobilefrontend menu to Allow configuration of the mobilefrontend menu and allow it to apply to any skin in mobile mode.Feb 3 2016, 12:25 AM
Jdlrobson updated the task description. (Show Details)
Jdlrobson moved this task from Backlog to Tech debt on the MobileFrontend board.Feb 18 2016, 6:46 PM
Jdlrobson raised the priority of this task from Low to Normal.Sep 1 2016, 4:02 PM
Jdlrobson added a project: Technical-Debt.
Jdlrobson added subscribers: MtMNC, Nirzar, Issimo_15.

Given the amount of interest in this... I'd really like us to give this some attention.

Qgil awarded a token.Sep 2 2016, 8:27 AM

This has been requested again
https://m.mediawiki.org/wiki/Topic:Te7sisox5t9z8xxf?markasread=481394

This is by far the most requested thing from third parties..

@ovasileva what do you think? Can we work on this soon? I think it's a good feature to have.

QuimGil edited subscribers, added: QuimGil; removed: Qgil.Oct 31 2016, 2:06 PM

This is by far the most requested thing from third parties..

+1

This feature might be interesting for Wikimedia projects as well.

phuedx added a comment.EditedNov 1 2016, 2:36 PM

MobileFrontend allows limited manipulation of the menu before it's rendered, though it's undocumented. There's MenuBuilder and the MobileMenu hook. Currently, however, the entries in the menu are hard-coded to be lumped into four pre-defined groups:

  1. Discovery
    • Home
    • Random
    • Nearby
  2. Personal
    • User:Foo / Logout
    • Watchlist
    • Contributions
  3. Configuration
    • Settings
  4. Sitelinks
    • About $wiki
    • Disclaimers

For 1, 2, and 4, the MobileMenu hook is run with a MenuBuilder instance that you can manipulate-ish that part of the menu.


I'm all for extending/superseding the current system with something more flexible and admin/developer friendly. Just remember that there's a hook that may need to be deprecated!

I think the problem is that for most using a hook is a bit overkill. Most 3rd parties want to people to edit an interface menu page or copy and paste something to LocalSettings.

The menu in other skins is configured via a mediawiki message (the logic is pretty complicated - check out SkinTemplate::buildContentNavigationUrls and/or https://www.mediawiki.org/wiki/Manual:Interface/Sidebar.

The problem with this approach for mobile is it is very limiting - it doesn't take into account icons for example or EventLogging and where text for items in a menu may be different from the page title (for example in mobile because of limited space we show a logout icon with no text). It also assumes all skins will have exactly the same menu, which is not practical for mobile - if you have a separate mobile experience it makes sense that the menu may be different.

I think at the very least we should strive to define the menu as a config option.

e.g.

'MFMenu' => { 'discovery': [], 'personal': [] ]

I'd rather not go down the message route, given it is wikitext there is far more that could go wrong. If we can derive icon values from keys/page titles, even better.

Just curious: what is the problem of offering the same approach as MediaWiki:Sidebar, just for mobile?

https://www.mediawiki.org/wiki/Manual:Interface/Sidebar

@QuimGil see https://phabricator.wikimedia.org/T65459#2760218
In case that wasn't clear, my worry with the interface sidebar approach is that it is more complicated. If we were to do that, I'd suggest we add tests and refactor the code in core beforehand. We could then add a MediaWiki:Mobile sidebar page that reused the logic and extended it to support the additional properties of our mobile menus.

Adding a config variable to control this would be considerably less work.

Just curious: what is the problem of offering the same approach as MediaWiki:Sidebar, just for mobile?
https://www.mediawiki.org/wiki/Manual:Interface/Sidebar

This! When you click the "hamburger" it pulls up the menu in a slide-out screen anyway, so why not make it as flexible and configurable for the end user as MediaWiki:Sidebar ?

Just curious: what is the problem of offering the same approach as MediaWiki:Sidebar, just for mobile?
https://www.mediawiki.org/wiki/Manual:Interface/Sidebar

From a technical perspective, I doubt there are any blockers. I'd like to hear from @Nirzar/Design.

Phispi added a subscriber: Phispi.Dec 8 2016, 8:49 PM
Nirmos added a subscriber: Nirmos.Jan 15 2017, 2:45 PM

Most of the discussion here and on https://www.mediawiki.org/wiki/Extension_talk:MobileFrontend seems to be about modifying the sidebar with PHP, but as a Wikipedia admin I need to do it with JavaScript. Is there an event that is fired when #mw-mf-page-left is done? If not, wouldn't it be easy to add such an event, so that mw.hook can be used to modify the sidebar?

Can you elaborate on the use case @Nirmos ? Why would you want to add a link via JavaScript?

What I meant was that this page and https://www.mediawiki.org/wiki/Extension_talk:MobileFrontend keeps referring to PHP files like LocalSettings that I can't modify anyway.

On Swedish Wikipedia (sv.wikipedia) there is a huge amount of bot created articles. The main criticism against these articles (at least from readers) is that Special:Slumpsida (Special:Random) in the sidebar is useless because 9/10 articles are created by bots. So, User:Prolineserver created a tool on tools.wmflabs that excludes bot created articles, and we have a link to that next to Special:Random. https://sv.wikipedia.org/wiki/MediaWiki:Gadget-ExkluderaRobotskapadeSidor.js does that nicely for the desktop version, and https://sv.wikipedia.org/wiki/MediaWiki:Gadget-ExkluderaRobotskapadeSidorMobil.js attempted to do the same for the mobile version, but I've removed it.

The important detail here is that I need to be able to add the link on the same line, so any PHP solution is unlikely to be sufficient anyway. Is there a reason not to add a mw.hook when the sidebar is done? It's one line of code, right?

mw.hook( 'mf-sidebardone' ).fire();

Thanks for sharing the use case!

Adding a link to the mobile menu would be a little problematic as the whole menu item is supposed to be tappable. Using JS would also not work for a variety of users who we send to this page: https://en.m.wikipedia.org/wiki/Special:MobileMenu

A PHP or a MediaWiki:Sidebar mobile approach would be better here, as you'd be able to add a small icon to the right just as we do with the username:


(imagine replacing Jdlrobson with Random and the power icon to the right with the new bot excluded link)

Side note: Is there an argument to be made that the exclude bot link should be default on mobile where the majority of users are readers (due to the difficulty of mobile editing)?

Still relevant, but mostly of use to third parties which is why there's been little movement here.

Jdlrobson renamed this task from Allow configuration of the mobilefrontend menu and allow it to apply to any skin in mobile mode to Allow configuration of the Minerva menu.Nov 22 2017, 5:57 PM
Reception123 added a subscriber: Reception123.
Reception123 removed a subscriber: Reception123.
Reception123 added a subscriber: Reception123.
Kghbln added a subscriber: Kghbln.
Pcj added a subscriber: Pcj.Jun 9 2018, 5:16 PM
Isarra added a subscriber: Isarra.Jul 7 2018, 6:10 PM

I recommend looking into what BlueSky does, both for icons and customisability. Essentially you probably want to create a second navigation interface message structured like the sidebar with an extra |item for icon specifying, with a parser that functions similarly to a simplified version of the sidebar parser that outputs a standard portlet/set of portlets. This approach allows for onwiki customisation both for the rendered html (editing the mediawiki namespace interface message) and js overrides using the standard addportletlink etc functions, which work with pretty much anything following the expected structure.

Isarra added a comment.Jul 7 2018, 6:11 PM

...may also want to add a config variable so third party sites can just throw in their sidebar instead of having an entirely separate menu.

Jdlrobson updated the task description. (Show Details)Aug 9 2018, 3:27 AM
QuimGil removed a subscriber: QuimGil.Aug 14 2018, 8:08 AM
ARR8 added a subscriber: ARR8.Feb 17 2019, 7:50 PM
Jona added a subscriber: Jona.Mar 1 2019, 9:30 AM
alexhollender added a subscriber: alexhollender.

@ovasileva @Jdlrobson just came across this in the design backlog, wanted to call it out since it's something we've been talking about with Advanced Mobile Contributions.

Magwac added a subscriber: Magwac.Jun 22 2019, 10:05 AM

Can you elaborate on the use case @Nirmos ? Why would you want to add a link via JavaScript?

IMO, there should be a way to customize this menu using user JavaScript files (common.js / minerva.js). Using userscripts is the only way I see for an individual user to customize this menu for his / her needs.

Can you elaborate on the use case @Nirmos ? Why would you want to add a link via JavaScript?

IMO, there should be a way to customize this menu using user JavaScript files (common.js / minerva.js). Using userscripts is the only way I see for an individual user to customize this menu for his / her needs.

Got it. This task is purely from the sysop perspective. Customising via JS gadgets is captured in another bug:

T231925: Minerva should support skin agnostic mw.util.addPortletLink or similar

Great idea, mw.util.addPortletLink can be used customize this menu.

Masumrezarock100 added a comment.EditedSun, Sep 15, 6:30 PM

I have no idea why this MW-1.27-release (WMF-deploy-2016-01-12_(1.27.0-wmf.10)) tag is still here.