Page MenuHomePhabricator

The User Menu drop down stays open even after navigating away from a page
Closed, ResolvedPublic2 Estimated Story Points

Description

Steps to reproduce:

  1. Go to this page: https://en.wikipedia.org/wiki/Main_Page.
  1. Open the User Menu and choose any of the options from the drop down to navigate away from this page.
  1. Click on the back button on browser.

Observed Result: The User Menu drop down stayed open even after navigating away from the page.

Screen Shot 2021-11-04 at 3.01.47 PM.png (956×2 px, 547 KB)

Environment: Beta cluster, en.wiki.

QA steps

Please perform the following steps in Safari, Chrome, Edge, and Firefox:

  1. Login to beta and go to https://en.wikipedia.beta.wmflabs.org/wiki/Dog?vectorstickyheader=1&useskinversion=2
  2. Click the user menu
  3. Click the Talk menu option
  4. After talk page has loaded, click your browser's "back" button
  5. Verify that the user menu is not open

Event Timeline

This is a browser feature. It could be argued that it's a useful feature or not. For example, if I open the user menu and click watchlist, clicking back will show me the user menu still open.

If we want to fix it, we just need to make sure we uncheck all menus in a beforeunload event but I'd like to check before we push that patch. @alexhollender can you confirm how this should behave?

@Volker_E it would be great if you could add your opinions here

Behavior is just true for the user menu links and not for any other links. Not even if we're providing some sort of focus for the menu item clicked, I'd see a user benefit here. If you click Watchlist and another link on the Watchlist page and then go back twice, suddenly the user menu is still open. It's more confusing than anything else IMO.

@Volker_E it's true for all dropdowns. So this is also true for the language button (with JS disabled) and the more menu. This is also how it works for legacy Vector and other skins.

If we want to fix this I'd suggest putting the fix inside the core mediawiki.checkboxtoggle module to fix all cases.

Suggest adding the code

window.onbeforeunload = function () {
  $('.vector-menu-checkbox').prop('checked', false)
};

This will probably need to be in Vector for now. If we're more ambitious about this, we'd add this to mediawiki.checkboxtoggle and add a standard clss e.g. mw-menu-checkbox.

Change 746975 had a related patch set uploaded (by Nray; author: Nray):

[mediawiki/skins/Vector@master] Close .vector-menu-dropdown menus in modern Vector beforeunload

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

nray subscribed.

Change 746975 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Close .vector-menu-dropdown menus in modern Vector beforeunload

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

nray updated the task description. (Show Details)
Jdlrobson moved this task from QA to QA in Prod on the Web-Team-Backlog (Kanbanana-FY-2021-22) board.
Jdlrobson added a subscriber: Edtadros.

This is in production.

Verified in production. Resolving.
QA:
Login to beta and go to https://en.wikipedia.org/wiki/Main_Page
Click the user menu
Click the Talk menu option
After talk page has loaded, click your browser's "back" button
Verify that the user menu is not open