Skip to content

fix: stack the sidebar above content on narrow viewports - #3249

Draft
AhtishamShahid wants to merge 1 commit into
openedx:masterfrom
AhtishamShahid:ahtisham/hq-12025-sidebar-responsive
Draft

AhtishamShahid wants to merge 1 commit into
openedx:masterfrom
AhtishamShahid:ahtisham/hq-12025-sidebar-responsive

Conversation

@AhtishamShahid

@AhtishamShahid AhtishamShahid commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Description

The sidebar sat beside the page content in a plain flex row with no responsive handling. Its panel is a fixed 440px and its icon rail ~74px, and neither shrinks, so below ~1000px the content column overflowed, slid under the opaque panel, and the page scrolled sideways — 134px at a 900px window.

The sidebar now moves above the content when there is no room for both, at full width with its icon buttons in a row. Nothing changes above the breakpoint, which is derived from the widths involved (440 panel + 74 rail + 440 minimum content + 48 gutters = 1002px) rather than hard-coded.

Three smaller things independently caused sideways scrolling too:

  • ResizableBox kept a dragged width after the window shrank. It now clamps as the window narrows, and restores your width when you widen again.
  • Outline card headers, the SubHeader action row, and the outline status bar could not wrap. They now wrap.
  • The collapsed-state placeholder div, a thin 2px gap beside the rail, is removed.

CSS and layout only — no API or data changes, and no change above the breakpoint.

Supporting information

Reported against an MIT Open Learning deployment; the originating issue is in a private tracker, so the detail is here rather than linked. I found no existing issue in this repo and am happy to file one. The behavior appears to start with #3057 and reproduces on master.

Testing instructions

Resize a real browser window — the fix depends on media queries.

  1. Open a course outline (/course/<course-id>) with the sidebar open and drag the window narrower. Before: a horizontal scrollbar below ~1035px, and cards sliced by the sidebar panel. After: no horizontal scrollbar at any width; at ~1000px the sidebar moves above the content, and back beside it when you widen.
  2. Repeat on a unit page (/container/<block-id>), which uses the same layout.
  3. Drag the sidebar wider by its handle, then narrow to ~1100px. Before it overflows; after it shrinks with the window.
  4. At ~500px, check the sub-header buttons, status bar items, and card badges and menus wrap rather than overflow.

Verified on this head: CI green including the tests job and coverage; tsc --noEmit and stylelint clean locally.

Other information

  • No new tests — CSS and layout change, and the suite has no viewport-driven setup to anchor one to.
  • Not fixed here: between ~842px and ~900px the Studio header wraps onto two rows, because @edx/frontend-component-header switches to MobileHeader only at maxWidth={841}. It wraps rather than overflows, so it causes no scrolling, and needs its own PR there.
  • Based on a July commit, and master has since touched six of these nine files — needs a rebase before merge.
  • The stacked sidebar sits above the content (order: -1), capped at 60vh. One-line change if you would rather it sat below.

Best Practices Checklist

  • Any new files are using TypeScript (.ts, .tsx) — no new files
  • Avoid propTypes and defaultProps in any new or modified code
  • Tests should use the helpers in src/testUtils.tsx — n/a, no tests added
  • Do not add new fields to the Redux state/store
  • Use React Query to load data from REST APIs — n/a, no data loading
  • All new i18n messages have a description — n/a, no new messages
  • Avoid using ../ in import paths — no imports added

The outline and unit pages laid the sidebar beside the page content in a
plain flex row with no responsive handling. The panel is a fixed 440px and
its icon rail ~74px, and neither shrinks, so below ~1002px the content
column overflowed its own width, slid underneath the opaque sidebar panel,
and pushed the page into horizontal scroll.

Stack the sidebar above the content below that width instead, which is what
the pre-rewrite Paragon grid did at `sm`/`xs`. The breakpoint is derived from
the widths involved rather than hard-coded. When stacked, the panel fills the
width, the drag handle is hidden, and the icon rail becomes a horizontal
toolbar above the panel.

Also fix the overflow sources that outlived the sidebar:

- ResizableBox kept a dragged width that no longer fit after the window was
  narrowed, so a widened sidebar overflowed at widths that were otherwise
  fine. Clamp it on render, keeping the preferred width in state.
- Outline card headers had a min-content width of ~520px because the badges
  and action menu could not wrap. Let them wrap.
- SubHeader's action row was `flex-shrink-0`, squeezing the title onto three
  or four lines and still overflowing. Let it shrink and wrap.
- The outline StatusBar could not wrap, so its last button overflowed.
- Drop the collapsed-state placeholder div, which rendered as a stray 2px
  bordered gap beside the rail.
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 15, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @AhtishamShahid!

This repository is currently maintained by @bradenmacdonald.

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.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.


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 Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.03%. Comparing base (ce86f1b) to head (5a97502).
⚠️ Report is 40 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3249      +/-   ##
==========================================
+ Coverage   95.77%   96.03%   +0.25%     
==========================================
  Files        1398     1407       +9     
  Lines       33425    34289     +864     
  Branches     7611     8150     +539     
==========================================
+ Hits        32014    32930     +916     
+ Misses       1367     1303      -64     
- Partials       44       56      +12     

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

2 participants