Skip to content

feat: Add V2 of header actions slot - #682

Open
ChrisChV wants to merge 1 commit into
openedx:masterfrom
open-craft:chris/header-actions-slot-v2
Open

feat: Add V2 of header actions slot#682
ChrisChV wants to merge 1 commit into
openedx:masterfrom
open-craft:chris/header-actions-slot-v2

Conversation

@ChrisChV

@ChrisChV ChrisChV commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

The showUserDropdown prop gated both the LearningHeaderActionsSlot and the AuthenticatedUserDropdown, making it impossible to hide the user dropdown without also hiding all the action items, and impossible for third-party plugins attached to that slot to render independently of the user dropdown's visibility.

This PR introduces a new org.openedx.frontend.layout.learning_header_actions.v2 slot:

  • v2 always renders, regardless of showUserDropdown. Use this slot ID for new plugin configurations that should render even when showUserDropdown is false.
  • v2 wraps the existing v1 slot (notifications tray + help link), which keeps its original behavior unchanged — only rendered when showUserDropdown is true — preserving backwards compatibility for existing consumers of v1.

This PR does not change any default, out-of-the-box visual behavior. With no custom plugin configuration,
the header looks and behaves exactly as it does on main, including with showUserDropdown={false}.
The only thing this PR unlocks is the ability for plugin authors to opt into .v2 so their own widgets render
independently of showUserDropdown.

A follow-up DEPR ticket will propose removing v1 once its default content (notifications tray + help link) can move into v2 unconditionally.

Supporting information

Testing instructions

Important: Before starting, ensure you have a Tutor environment with the Learning MFE in development mode running.

  1. Clone the repo. From the main branch, run npm ci && npm run build.
  2. From the Learning MFE, run npm install "../path/to/this/repo" --legacy-peer-deps.
  3. Add the following to frontend-app-learning/env.config.jsx to set showUserDropdown: false:
   import { PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';

   const hideUserMenu = (widget) => {
    widget.content = {
      ...widget.content,
      showUserDropdown: false,
    };
    return widget;
  };

   export default {
     pluginSlots: {
       'org.openedx.frontend.layout.header_learning.v1': {
         keepDefault: true,
         plugins: [
           {
             op: PLUGIN_OPERATIONS.Modify,
             widgetId: 'default_contents',
             fn: hideUserMenu,
           },
         ],
       },
     },
   };
  1. Add the following to frontend-app-learning/module.config.js:
module.exports = {
  localModules: [
    {
      moduleName: '@edx/frontend-component-header',
      dir: '../frontend-component-header', // adjust this relative to your repo
    },
  ],
};
  1. Run the Learning MFE in dev mode with main checked out on this repo. Confirm that with showUserDropdown: false, the user dropdown, notifications, and "Help" link are hidden (pre-PR behavior).
  2. Switch this repo to this PR's branch and run npm run build
  3. Confirm the header still looks the same as step 5 — no regression.

Introduce a v2 version of LearningHeaderActionsSlot that always mounts,
wrapping the existing v1 slot (HeaderNotificationsSlot and
LearningHelpSlot) which stays gated behind showUserDropdown. This
preserves the v1 slot API contract for existing plugin consumers while
allowing new plugins to attach to v2 unconditionally.

Note: HeaderNotificationsSlot/LearningHelpSlot remain hidden when
showUserDropdown is false. Fully decoupling them from showUserDropdown
requires deprecating v1 first, and is left for a
follow-up once the DEPR lands.
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Aug 25, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @ChrisChV!

This repository is currently maintained by @openedx/committers-frontend.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.33%. Comparing base (e380431) to head (d113c03).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #682      +/-   ##
==========================================
+ Coverage   73.07%   73.33%   +0.25%     
==========================================
  Files          60       61       +1     
  Lines         520      525       +5     
  Branches      110      110              
==========================================
+ Hits          380      385       +5     
  Misses        137      137              
  Partials        3        3              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

3 participants