Menus close when you click a link inside them
Dropdown menus, like the table of contents, now close when you click a link inside them instead of staying open over the page.
The problem
On a narrow window, Vector 2022 shows the table of contents as a dropdown menu next to the page title. Clicking the words of a heading in it jumped to that section, but left the menu open on top of the article. It only closed when the click landed on the empty space next to the words.
What I changed
The code that closes these menus only looked at the link itself and the element right inside it. The heading's words sit one level deeper, so their clicks were missed. The check now looks for any link around the clicked spot, so a click anywhere inside a link closes the menu. A new test with four cases fails without the fix.
Where it runs now
Merged into MediaWiki core, so it reaches Wikipedia and the other Wikimedia wikis with the weekly software update.
Related contributions
- In review
Add a Cancel button to the watch and unwatch forms
When a page is watched or unwatched without JavaScript, for example from the Minerva menu on a basic phone or by opening ?action=watch directly, MediaWiki shows a form asking "Add this page to your watchlist?" with…