feat: add rightSidebar config option, closes #1282 - #2777
Conversation
|
@AmanUllah687 is attempting to deploy a commit to the Docsify Team on Vercel. A member of the Team first needs to authorize it. |
|
Thanks for the contribution. The feature in this PR overlaps with #2772 (and the earlier #1288). For the current v5 codebase, #2772 uses the more expressive sidebarPosition: 'left' | 'right' API, keeps the default behavior explicit, and provides Playwright coverage for both desktop and mobile layout geometry. This PR uses a separate rightSidebar API and primarily tests the body class, which would leave two competing configuration styles and duplicate layout implementations for the same feature. |
Thanks for the context — makes sense, #2772 is more thorough (the sidebarPosition enum is a cleaner API than my boolean, and the Playwright geometry tests go further than what I had). Good to know it's already merged. I'll close this one out. Appreciate you taking the time to explain rather than just closing it silently — good to know for next time. |
Description
Adds a
rightSidebarboolean config option (default:false) that positions the sidebar on the right side of the page instead of the left.Implemented by toggling a
right-sidebarclass on<body>based on the config value, with CSS handling the layout flip — desktop positioning, the mobile overlay/backdrop behavior, and the sidebar toggle button's position and slide animation.Related issue(s)
Closes #1282
Type of change
How Has This Been Tested?
right-sidebarclass is correctly added/omitted based on config (test/integration/sidebar.test.js)npm run build,npm run lint, unit tests, integration tests, and e2e tests (Chromium, Firefox, WebKit)Screenshots below.
Desktop, rightSidebar: true

Mobile, sidebar closed (default)

Mobile, sidebar open

Checklist
docs/configuration.md)