Page MenuHomePhabricator

Minerva page actions menu should support extension
Closed, ResolvedPublic3 Estimated Story Points

Description

Background

It is not possible for extensions to extend the page actions menu in Minerva. This means it's currently not possible to add the bookmark link to the desired place in Minerva.

User story

As a developer of the reading list I want to add a bookmark to the menu next to the edit icon (or to replace the watch star).

Requirements

The following code adds a bookmark icon to the Vector skin with the desired markup:

$wgHooks['SkinTemplateNavigation::Universal'][] = function ( $t, &$s ) {
	$s['views']['bookmark'] = [
		'icon' => 'bookmark',
		'text' => 'bookmark',
		'href' => '/wiki/Foo'
	];
};

On mobile it has no effect.
The MediaWiki\Minerva\Menu\PageActions\ToolbarBuilder::getGroup method currently ignores the hook and provides custom logic for its construction. This should be revised so that any defined link which has an icon is included.

BDD

Feature: Extend Minerva page actions menu for custom links

  Scenario: Default page actions appear in the Minerva menu  
    Given I visit a page using the Minerva skin  
    When the page loads  
    Then the page actions menu displays the download PDF, watch, and edit icons

  Scenario: Custom bookmark icon is added via extension  
    Given the extension hook for adding a bookmark link is enabled
    When I visit a Minerva page  
    Then the page actions menu displays a bookmark icon with the correct markup

  Scenario: Ellipsis menu appears when AMC is enabled  
    Given AMC is enabled  
    When I view the page actions menu in Minerva  
    Then an ellipsis menu is displayed

Test Steps

Test Case 1: Verify default page actions in Minerva menu

  1. Visit any page using the Minerva skin.
  2. Confirm that the page actions menu displays the download PDF, watch, and edit icons.
  3. AC1: Confirm that these default icons are present.

Test Case 2: Verify custom bookmark icon via extension hook

  1. Enable the following hook code in LocalSettings or a test extension:
$wgHooks['SkinTemplateNavigation::Universal'][] = function ( $t, &$s ) {
    $s['views']['bookmark'] = [
        'icon' => 'bookmark',
        'text' => 'bookmark',
        'href' => '/wiki/Foo'
    ];
};
  1. Visit a page using the Minerva skin.
  2. Confirm that the page actions menu now includes the bookmark icon with the correct icon and link.
  3. AC2: Confirm the bookmark icon is visible next to the existing actions.

Test Case 3: Verify ellipsis menu appears with AMC enabled

  1. Enable AMC (the relevant configuration for AMC) on the test environment.
  2. Visit a page using the Minerva skin.
  3. Confirm that an ellipsis menu appears in the page actions menu.
  4. AC3: Confirm the ellipsis menu is present when AMC is enabled.

Design

  • Add mockups and design requirements

Acceptance criteria

In the Minerva skin:

  • The download pdf, watch, edit icons are in the menu
  • When the code in requirements is run a bookmark icon also shows
  • when amc is enabled I see an ellipsis menu

Communication criteria - does this need an announcement or discussion?

  • Add communication criteria

Rollback plan

  • What is the rollback plan in production for this task if something goes wrong?

QA Results - Beta

ACStatusDetails
1T388909#10702071
2T388909#10702071
3T388909#10702071

QA Results - Prod

ACStatusDetails
1T388909#10711291
2T388909#10711291
3T388909#10711291

This task was created by Version 1.2.0 of the Web team task template using phabulous

Details

Event Timeline

Jdlrobson-WMF renamed this task from Web Task Creation Form to Minerva page actions menu should support extension.Mar 14 2025, 4:40 PM
Jdlrobson-WMF changed the task status from Open to In Progress.Mar 14 2025, 4:43 PM
Jdlrobson-WMF triaged this task as Medium priority.
Jdlrobson-WMF moved this task from Incoming to Q3 on the Web-Team board.
Jdlrobson-WMF set the point value for this task to 3.Mar 17 2025, 9:55 PM
Jdlrobson-WMF moved this task from Q3 to Sprint Backlog on the Web-Team board.

Will unblock work in the reading list project.

Change #1131808 had a related patch set uploaded (by Kimberly Sarabia; author: Kimberly Sarabia):

[mediawiki/skins/MinervaNeue@master] Modify page actions functionality

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

Change #1131808 merged by jenkins-bot:

[mediawiki/skins/MinervaNeue@master] Modify page actions functionality

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

Test Case 2: Verify custom bookmark icon via extension hook

I can vouch that this one is passing.

Edtadros removed Edtadros as the assignee of this task.EditedApr 2 2025, 2:44 AM
Edtadros subscribed.

Test Steps

Status: ✅ PASS
Environment: Beta (mylists.wmcloud.org)
OS: macOS
Browser: Chrome
Device: MS

Test Case 1: Verify default page actions in Minerva menu

  1. Visit any page using the Minerva skin.
  2. Confirm that the page actions menu displays the download PDF, watch, and edit icons.
  3. ✅ AC1: Confirm that these default icons are present.

screenshot 241.png (758×1 px, 78 KB)

Test Case 2: Verify custom bookmark icon via extension hook

  1. Enable the following hook code in LocalSettings or a test extension:

$wgHooks['SkinTemplateNavigation::Universal'][] = function ( $t, &$s ) {

$s['views']['bookmark'] = [
    'icon' => 'bookmark',
    'text' => 'bookmark',
    'href' => '/wiki/Foo'
];

};

  1. Visit a page using the Minerva skin.
  2. Confirm that the page actions menu now includes the bookmark icon with the correct icon and link.
  3. ✅ AC2: Confirm the bookmark icon is visible next to the existing actions.

see T388909#10701997

Test Case 3: Verify ellipsis menu appears with AMC enabled

  1. Enable AMC (the relevant configuration for AMC) on the test environment.
  2. Visit a page using the Minerva skin.
  3. Confirm that an ellipsis menu appears in the page actions menu.
  4. ✅ AC3: Confirm the ellipsis menu is present when AMC is enabled.

screenshot 240.png (760×1 px, 92 KB)

Jdlrobson-WMF updated the task description. (Show Details)

Test Steps

Status: ✅ PASS
Environment: enwiki
OS: macOS
Browser: Chrome
Device: MS

Test Case 1: Verify default page actions in Minerva menu

  1. Visit any page using the Minerva skin.
  2. Confirm that the page actions menu displays the download PDF, watch, and edit icons.
  3. ✅ AC1: Confirm that these default icons are present.

screenshot 244.png (759×1 px, 342 KB)

Test Case 2: Verify custom bookmark icon via extension hook

  1. Enable the following hook code in LocalSettings or a test extension:

$wgHooks['SkinTemplateNavigation::Universal'][] = function ( $t, &$s ) {

$s['views']['bookmark'] = [
    'icon' => 'bookmark',
    'text' => 'bookmark',
    'href' => '/wiki/Foo'
];

};

  1. Visit a page using the Minerva skin.
  2. Confirm that the page actions menu now includes the bookmark icon with the correct icon and link.
  3. ⬜ AC2: Confirm the bookmark icon is visible next to the existing actions.

@Jdlrobson-WMF is this something you can verify in prod?

Test Case 3: Verify ellipsis menu appears with AMC enabled

  1. Enable AMC (the relevant configuration for AMC) on the test environment.
  2. Visit a page using the Minerva skin.
  3. Confirm that an ellipsis menu appears in the page actions menu.
  4. ✅ AC3: Confirm the ellipsis menu is present when AMC is enabled.

screenshot 245.png (759×1 px, 216 KB)