wikimedia-gadgets / MoreMenu

The missing navigation system for MediaWiki
https://meta.wikimedia.org/wiki/Special:MyLanguage/MoreMenu
MIT License
7 stars 13 forks source link

Make MoreMenu gadget more future proof #26

Closed jdlrobson closed 7 months ago

jdlrobson commented 2 years ago

Clone an existing menu to work out the menu structure. (Follow up to #25#issuecomment-1064558959 )

@MusikAnimal what do you think about this patch? While it won't prevent breakage, I think it will reduce the breakage. It will also throw an error when action needs to be taken, so when it does break we'll know right away (hopefully via an email alert).

jdlrobson commented 2 years ago

(Full disclosure: final code untested as I couldn't work out how to get it running locally)

jdlrobson commented 2 years ago

Thanks for updating README. Run out of time today, but can take a look tomorrow and give the readme a spin.

jdlrobson commented 2 years ago

Amended and tested:

Screen Shot 2022-03-17 at 1 19 37 PM
jdlrobson commented 1 year ago

I had another idea of how we might approach this here - https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/878212 I quite like this idea as it allows skins to reimplement the mediawiki.util methods. If not implemented in the skin it would throw an exception so the more menu code would look something like

try {
  var moreMenu = mw.util.addPortlet( 'p-more', [ { href:'#', text: 'link 1' } ] )
} catch (e) {
 // existing code.
}
jdlrobson commented 1 year ago

@MusikAnimal looks like this broke again: https://phabricator.wikimedia.org/T337893

I'm still out on vacation, but perhaps we could work together on the core code to find a more long term solution here.

MusikAnimal commented 7 months ago

Almost 2 years since this PR was opened! I think now that we're using mw.addPortlet, the risk of future breakage is a bit lower. Changes to CSS classes on individual menu items is still prone to breakage, but I'm comfortable with updating MoreMenu as necessary when this happens, so I will close this PR.

I want to thank you @jdlrobson for going out of your way to create this PR, and for all of your efforts to mitigate conflicts with scripts/gadgets as Vector 2022 evolved.