Repository navigation
fix(styles): make the phone menu opaque and fit the navbar at every width - #223
Merged
Merged
Conversation
…idth The menu drawer was see-through on phones. `.vp-sidebar` is transparent so it blends with the page on desktop, but at the mobile breakpoint and below it is the drawer laid over the page, and the page text showed through the menu. It now has the page background there, in dark and light mode. The navbar's ten links, search label and key hints need about 1400px. From 720px to about 1395px they pushed the search button and the color-mode toggle off screen: on landscape phones, on tablets, and on laptops at 1280px and 1366px. `$MQMobile` is now 1279px in palette.scss, so below 1280px the links move into the menu drawer. From 1280px to 1439px the search button shows as an icon, as the slimsearch plugin already does below 960px, and the gap between links drops from 1.5rem to 1rem. At 1440px and wider the navbar is unchanged. Below 1280px the sidebar is the menu drawer as well, so tablets and small laptop windows get full-width content and open the page tree from the menu button, as phones already did. The alternative, keeping the sidebar there, needs fewer top-level navbar items. The default theme reads $MQMobile from the palette file for both its CSS and its JS, as its styles docs describe. The same pattern fixed the sibling FLUID site in open-data-protocol/fluid#54.
Two defects that the wider drawer range exposed. Both were already present on phones. The theme slides the closed drawer off screen but leaves it visible, so its ~300 links stayed in the tab order and keyboard focus vanished off screen. The drawer is now `visibility: hidden` until it opens, with a 0.3s delay on close so it stays visible while it slides away. The theme makes the site name a block as wide as the bar's free space, so a long name can end in an ellipsis. Inside the inline brand link that stretched the link across the bar, and a click on empty bar space went home. The name is now inline-block with the same width cap, so the link is only as wide as the name. The compact-navbar query now uses range syntax, `width > 1279px`, so a fractional width between 1279px and 1280px also gets the compact bar.
This branch was previously deployed
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.
What was wrong
.vp-sidebar { background: transparent }let the page show through the open drawer, so the menu text overlapped the page and could not be read.What changed (styles only)
palette.scss:$MQMobile: 1279px. The default theme reads its mobile breakpoint from this file, in both its CSS and its JS, so below 1280px the navbar links move into the menu drawer.index.scss:visibility: hidden, so its ~300 links leave the tab order until it opens. Before, they took keyboard focus off screen.Trade-off
Below 1280px the page-tree sidebar is in the menu drawer too. Tablets and small laptop windows get full-width content and open the sidebar from the menu button, as phones already did. Keeping a persistent sidebar at those widths would need fewer top-level navbar items. The breakpoints are measured, and
palette.scsssays to re-measure when a top-level item is added.Prior art
@vuepress/theme-defaultdocuments overriding$MQMobileinpalette.scss: https://ecosystem.vuejs.press/themes/default/styles@vuepress/plugin-slimsearchalready shows its button as an icon below 960px; the compact bar reuses that state.navbarguide), or a "More" overflow menu (Tabler). Both need theme markup and JS, and this repo's stylesheet only restyles the theme's existing markup.Validation
npm run docs:buildpasses. Its only warnings are the two existing Vite ones.ripwire --quality-delta: no regressions.Reviews
<) and CSS (<=) disagree on the breakpoint, as they did at 719px.Not checked on a real iPhone or iPad; this used Chrome's device emulation only.