Fix header collisions and the mobile menu - #542
Merged
Conversation
The centre zone was positioned absolutely, so the side zones kept their full half of the row and the external links ran under the search field and the colour-mode toggle between 997px and roughly 1180px — 1024px laptops and iPads sat in the middle of that band. Laid out in flow, with the side zones on an equal share, the centre lands on the same midline without overlapping anything. Below the breakpoint the wordmark's fixed widths (312px, 220px under 768px) pushed the search button and the toggle off the right edge. It now shrinks to fit. Dropping theme-classic's <NavbarSearch> wrapper takes the search field out of the rule that pinned it to the navbar's right edge on mobile, where it landed on top of the toggle.
The navbar's background is transparent because the fixed wrapper in Navbar/Layout paints the header, and Infima's drawer reads the same variable — so opening the menu on a phone showed the page through it. Fixes #541
The drawer's first level listed the four off-site links and nothing else: the section nav is hidden below 997px and the drawer's second level only exists on pages that have a sidebar, so away from a doc page there was no way into the docs at all. It now opens on the same sections the section nav shows on desktop, drawn from the same config and marked active by the same matcher the sidebar filter uses, with the Releases dropdown flattened to its index page. Follows the two-level mobile menu on docs.moderne.io.
react-player writes its size inline as 640x360, so every embedded video ran off the side of the viewport below that width. Capping the width and deriving the height from the ratio fixes all twelve pages at once.
sjungling
approved these changes
Sep 2, 2026
sjungling
left a comment
Contributor
There was a problem hiding this comment.
minimize code comments
Why over what, inline over doc blocks, and standard labels where they apply. Rationale a reader wants at this depth is in the PR and the commit messages.
The header copied from the other swizzles points at "the MIT license found in the LICENSE file in the root directory of this source tree" — true in the Docusaurus repo, but this tree's LICENSE is Apache-2.0. The derived part is the navbar-items list, so that is what it now credits.
Nothing in the file is Facebook's expression. What it shares with theme-classic's PrimaryMenu is two hook calls, an Infima class name and a map over NavbarItem — the only way to call that API, not a copied implementation. Nine of the twelve swizzles here carry no notice either.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Objectives
Assumptions
.navbarRightflex override already depends on this;min-width: max-contentbeats.navbar__items { min-width: 0 }on the same basis.<NavbarSearch>wrapper contributes nothing except the class that positions the field, so dropping it is preferable to overriding a hashed class name.findSectionis the one matcher for "which section is the reader in". A URL prefix cannot answer it: Lists and Reference both serve documents from/reference, and Concepts is served at/concepts-explanationswhile its documents live at/concepts-and-explanations.Changes
(1)src/theme/Navbar/Content/styles.module.css: the centre zone is laid out in flow, with both side zones on an equal share (flex: 1), which lands it on the same midline the absolute positioning targeted. The right zone holds atmin-width: max-contentso the links never spill leftwards.(1)src/theme/Navbar/Content/index.tsx: renders<SearchBar />directly instead of through<NavbarSearch>, so upstream's mobileposition: absolutenever applies; drops the now-redundantmobileControlswrapper and renders the centre zone conditionally.(1)src/css/custom.css:.navbar__logobecomes elastic (flex: 0 1 auto,min-width: 0,object-fit: contain) and the two fixed-width media queries go away.(2)src/css/custom.css:.navbar-sidebarre-points--ifm-navbar-background-colorrather than settingbackground-color, so anything else in the drawer reads the same ground.(3)src/theme/Navbar/MobileSidebar/PrimaryMenu/: new swizzle listing the sections above the navbar items, marked active byfindSectionand closing the drawer on click.(3)src/config/navSections.ts: addsmobileSections, derived fromprimarySectionswith the Releases dropdown flattened to its index page; finishes theALL_RELEASES_HREFconstant so/changeloghas one definition.(4)src/css/custom.css:.reactPlayergainsmax-width: 100%andaspect-ratio: 16 / 9, fixing all twelve pages at once.Notes
SecondaryNav: the overlap is about six lines, while the DOM contract (Infimamenu__*classes vs local ones), the data (flattened Releases vs a stateful dropdown) and the behaviour (drawer-close vs outside-click/Escape) all differ. They do share the data and the matcher, which is the part that could drift.height: auto !importanton.reactPlayeris the only way to beat react-player's inline height. RegisteringReactPlayerinsrc/theme/MDXComponentswould remove the need and drop twelve import lines — worth a follow-up.SecondaryNav'sdropdownItemActivecannot mark the per-release entries,findSection's prefix fallback has no path-boundary check, and the twelve video pages passcontrols="true"as a string.mask-image,width,height.Closes #541