Skip to content

feat: add rightSidebar config option, closes #1282 - #2777

Closed
AmanUllah687 wants to merge 1 commit into
docsifyjs:developfrom
AmanUllah687:feat/right-sidebar
Closed

feat: add rightSidebar config option, closes #1282#2777
AmanUllah687 wants to merge 1 commit into
docsifyjs:developfrom
AmanUllah687:feat/right-sidebar

Conversation

@AmanUllah687

Copy link
Copy Markdown

Description

Adds a rightSidebar boolean config option (default: false) that positions the sidebar on the right side of the page instead of the left.

Implemented by toggling a right-sidebar class 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

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Added integration tests confirming the right-sidebar class is correctly added/omitted based on config (test/integration/sidebar.test.js)
  • Verified full local test suite passes: npm run build, npm run lint, unit tests, integration tests, and e2e tests (Chromium, Firefox, WebKit)
  • Manually tested in Chrome at desktop width and at mobile width (iPhone XR emulation), confirming:
    • Desktop: sidebar renders on the right, content shifts correctly
    • Mobile: sidebar is hidden by default, toggle button opens it as a right-side overlay with backdrop-tap-to-close, matching the existing left-sidebar mobile behavior

Screenshots below.

Desktop, rightSidebar: true
screencapture-10-110-12-101-4000-2026-08-04-01_34_16

Mobile, sidebar closed (default)
Screenshot 2026-08-04 014302

Mobile, sidebar open
Screenshot 2026-08-04 014331

Checklist

  • My code follows this project's style guidelines
  • I have added tests that prove my fix/feature works
  • I have updated the documentation (docs/configuration.md)
  • This is not a breaking change

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

@AmanUllah687 is attempting to deploy a commit to the Docsify Team on Vercel.

A member of the Team first needs to authorize it.

@sy-records

Copy link
Copy Markdown
Member

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.

@sy-records sy-records closed this Aug 4, 2026
@AmanUllah687

Copy link
Copy Markdown
Author

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.

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.

option to put sidebar on the right

2 participants