Skip to content

fix(layout): consolidate 2 sidebar layout across content types#1265

Merged
LeoMcA merged 12 commits intomainfrom
layout-consolidation
Feb 3, 2026
Merged

fix(layout): consolidate 2 sidebar layout across content types#1265
LeoMcA merged 12 commits intomainfrom
layout-consolidation

Conversation

@LeoMcA
Copy link
Member

@LeoMcA LeoMcA commented Jan 30, 2026

Split from #1154 to extract the layout refactor/consolidation work without changing the gap between sidebar content and layout content so that can be discussed/approved by content.

Introduces a unified approach to how we do our 2 sidebar layout across docs, curriculum and generic content.

Commits are atomic, and some have lengthy explanations in their commit message: I'd recommend reviewing one by one.

Fixes these issues:

  • fix for an issue where just above our mobile breakpoint the top placement would still be shown, breaking the toggleable sidebar overlay
  • partial reversion of dff52a5, fixing this issue instead by:
    • allowing the left sidebar to show items in the minimum page margin on the left
    • showing the outline on each sidebar inset
  • fixes the right sidebar scrollbar appearing offset from the page scrollbar
  • fixes docs, curriculum and generic content using the 2 sidebar layout in subtly different ways requiring updates in multiple places to increase the padding between sidebar and content everywhere

If we like this approach, we should probably migrate all the other layouts using the variables to a class-based system, but it felt like I'd got to a coherent and consistent place with this so stopped here.

LeoMcA added 11 commits January 30, 2026 09:41
add --layout-sidebar-padding variable for padding between sidebar
content and document content, so the scrollbar isn't pushed up against
the content

this removes my ugly hack from before where I set a negative right
margin on the left sidebar

sets --layout-sidebar-padding to 1rem + 2px to make the gap between sidebar
content and document content the same as it currently is

increases --layout-sidebar-min by 1rem so sidebars content doesn't get
any narrower

absorbs the --layout-side-padding-min padding into the left of the left
sidebar to avoid 2px padding for focus outlines and give us greater
flexibility with the sidebar layout in the future

does the same on the right of the right sidebar to align the right
sidebar scrollbar with the right of the screen on smaller displays
move them up to .reference-layout__sidebar
…from 2-sidebars

committed with --no-verify to make diffs almost inverse of each other
.layout__2-sidebars for when the right sidebar is to be hidden on mobile

.layout__2-sidebars-inline for when the right sidebar is to be put
between content header and body on mobile
otherwise we can't consistently position the overlayed sidebar: scroll
to top of page, resize page width to 790px and toggle sidebar to repro

keeping both media queries because --screen-layout-no-sidebar may change
to be smaller than --screen-small-and-narrower in the future again (we
don't want to have to go update other files as we change our min content
and sidebar sizes and paddings)
urls for testing each renderer:
CurriculumAbout: http://localhost:3000/en-US/curriculum/about-curriculum/
CurriculumDefault: http://localhost:3000/en-US/curriculum/faq/
CurriculumModule: http://localhost:3000/en-US/curriculum/getting-started/soft-skills/
CurriculumOverview: http://localhost:3000/en-US/curriculum/getting-started/
@LeoMcA LeoMcA requested a review from a team as a code owner January 30, 2026 09:48
@LeoMcA LeoMcA requested a review from caugner January 30, 2026 09:48
@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 2026

ba08f2e was deployed to: https://fred-pr1265.review.mdn.allizom.net/

Copy link
Member Author

@LeoMcA LeoMcA left a comment

Choose a reason for hiding this comment

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

Copied review comments from #1154 (review)

@@ -0,0 +1,141 @@
.layout__2-sidebars,
.layout__2-sidebars-inline {
Copy link
Member Author

Choose a reason for hiding this comment

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

from @caugner: [nit] maybe:

Suggested change
.layout__2-sidebars-inline {
.layout__2-sidebars--inline {

@@ -0,0 +1,141 @@
.layout__2-sidebars,
Copy link
Member Author

Choose a reason for hiding this comment

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

from @caugner: [nit] maybe add comment explaining the different classes, and where they are used

Comment on lines 5 to 18
/* Sidebar */
.generic-layout__sidebar {
grid-area: sidebar;
padding: 2rem 0;
padding-block: 2rem;
}

/* Content */
.generic-layout__content {
grid-area: body;
padding: 2rem 0;
padding-block: 2rem;
}

/* TOC */
.generic-layout__toc {
grid-column: toc;
padding: 2rem 0;
padding-block: 2rem;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

from @caugner: [nit] should these blocks be merged now?

}

@media (--screen-small-and-narrower) {
@media (--screen-small-and-narrower) or (--screen-layout-no-sidebar) {
Copy link
Member Author

Choose a reason for hiding this comment

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

from @caugner: does this mean we show placements less often?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really: it moved the breakpoint horizontally by about 25px to avoid this buggy layout:

Screen Shot 2026-02-03 at 17 54 02

@LeoMcA LeoMcA merged commit 85dd580 into main Feb 3, 2026
13 checks passed
@LeoMcA LeoMcA deleted the layout-consolidation branch February 3, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants