Skip to content

Adds showNavbar and showSearchButton props to CourseTabsNavigationSlot#1932

Closed
jacobo-dominguez-wgu wants to merge 2 commits into
openedx:masterfrom
WGU-Open-edX:toolbar-slot-props
Closed

Adds showNavbar and showSearchButton props to CourseTabsNavigationSlot#1932
jacobo-dominguez-wgu wants to merge 2 commits into
openedx:masterfrom
WGU-Open-edX:toolbar-slot-props

Conversation

@jacobo-dominguez-wgu

Copy link
Copy Markdown
Contributor

Description

Adds showNavbar and showSearchButton props to the CourseTabsNavigationSlot, allowing operators to hide the course tab links and/or search toggle button through plugins framework without replacing the entire slot.

  • Added showNavbar (default: true) to CourseTabsNavigation — when false, hides the container-xl wrapper including tab links and search button.
  • Added showSearchButton (default: true) — when false, hides only the search toggle button.
  • Added new tests covering all conditional rendering paths for both props.

Configuration example

'org.openedx.frontend.learning.course_tabs_navigation.v1': {
  keepDefault: true,
  plugins: [
    {
      op: PLUGIN_OPERATIONS.Modify,
      widgetId: 'default_contents',
      fn: (widget) => {
        widget.content = { showNavbar: false };
        return widget;
      }
    },
  ]
}

…onSlot

- Add showNavbar prop to conditionally render the nav bar
- Add showSearchButton prop to conditionally render the search toggle
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @jacobo-dominguez-wgu!

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

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.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Jun 18, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Jun 18, 2026
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.32%. Comparing base (6f1dfbb) to head (b84e42b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1932      +/-   ##
==========================================
+ Coverage   91.30%   91.32%   +0.01%     
==========================================
  Files         346      346              
  Lines        5776     5784       +8     
  Branches     1350     1358       +8     
==========================================
+ Hits         5274     5282       +8     
  Misses        483      483              
  Partials       19       19              

☔ 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.

@brian-smith-tcril

Copy link
Copy Markdown
Contributor

Could you update the README for the slot to include the props (and possibly an example using them)?

@diana-villalvazo-wgu diana-villalvazo-wgu moved this from Needs Triage to In Eng Review in Contributions Jun 18, 2026
@jacobo-dominguez-wgu

Copy link
Copy Markdown
Contributor Author

Could you update the README for the slot to include the props (and possibly an example using them)?

Sure. I have updated the slot readme with props docs and examples.

@diana-villalvazo-wgu diana-villalvazo-wgu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@jesusbalderramawgu jesusbalderramawgu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@brian-smith-tcril brian-smith-tcril left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the direction we should go with this slot.

The comments I left are coming from a "we want to land these pluginProps" perspective, but I'd like to think big picture a bit first.

The version of CourseTabsNavigationSlot in master right now

export const CourseTabsNavigationSlot = ({ tabs, activeTabSlug }: CourseTabsNavigationProps) => (
  <PluginSlot id="org.openedx.frontend.learning.course_tabs_navigation.v1">
    <CourseTabsNavigation tabs={tabs} activeTabSlug={activeTabSlug} />
  </PluginSlot>
);

has no pluginProps, meaning someone who wanted to replace the CourseTabsNavigation component wouldn't have access to activeTabSlug or tabs.

If the goal of this is to just hide everything but the search dialog (as the "Hide the navigation bar" example shows), then I think that can be accomplished with the slot as-is (without adding any props):

import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';

import { CoursewareSearch } from '@src/course-home/courseware-search';
import { useCoursewareSearchState } from '@src/course-home/courseware-search/hooks';

const CourseTabsNavigation = () => {
  const { show } = useCoursewareSearchState();

  return (
    <div id="courseTabsNavigation" className="mb-3 course-tabs-navigation">
      {show && <CoursewareSearch />}
    </div>
  );
};

const config = {
  pluginSlots: {
    "org.openedx.frontend.learning.course_tabs_navigation.v1": {
      keepDefault: false,
      plugins: [
        {
          op: PLUGIN_OPERATIONS.Insert,
          widget: {
            id: 'custom_tab',
            type: DIRECT_PLUGIN,
            RenderWidget: CourseTabsNavigation
          },
        },
      ],
    },
  },
}

export default config;

Comment on lines 74 to 78
it('should NOT render CoursewareSearch if the flag is off', () => {
renderComponent();

expect(screen.queryByTestId('courseware-search-dialog')).not.toBeInTheDocument();
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on board with testing by role instead of test id, but when I first saw this change it made me think it was needed for the tests to pass. Is the test id still being used by other tests? If not, it could be removed (and then the "why is this changing?" question would have a clear answer: "the test id was removed")

{showNavbar && (
<div className="container-xl">
<div className="nav-bar">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

</div>
</div>
)}
{show && <CoursewareSearch />}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be good to rename show now that there are 2 other shows being used in here.

@jacobo-dominguez-wgu

Copy link
Copy Markdown
Contributor Author

If the goal of this is to just hide everything but the search dialog (as the "Hide the navigation bar" example shows), then I think that can be accomplished with the slot as-is (without adding any props)

Alright, this example perfectly works for our use case. Thank you!

@github-project-automation github-project-automation Bot moved this from In Eng Review to Done in Contributions Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants