Fix docs ThemeSelect dropdown causing page scroll on /docs index #2689
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 does this PR do?
This PR fixes an issue where opening the Theme dropdown on the /docs index page caused the entire page to scroll.
The root cause was that the dropdown menu was rendered inside the /docs
scroll container because portal was set to null. This caused Melt UI / Floating UI to scroll the container in order to satisfy dropdown positioning constraints.The fix portals the dropdown menu to document.body, removing it from the nested scroll context and preventing unwanted page scrolling. This follows standard production practices used in most design systems for dropdowns and popovers.
This change does not affect article pages, mobile behavior, or any other Select usage.
Test Plan
Run the website locally using bun run dev.
Navigate to /docs.
Scroll near the footer and open the Theme dropdown.
Verify that the page does not scroll when the dropdown opens.
Navigate to /docs/advanced/* or /docs/tutorials/*.
Open the Theme dropdown and verify behavior remains unchanged.
Test on mobile view to ensure native select behavior is unaffected.
Related PRs and Issues
This PR resolves the Theme dropdown scroll issue reported in the Appwrite website docs discussion.
#2604
Have you read the Contributing Guidelines on issues?
Yes, I have read and followed the contributing guidelines.
Summary by CodeRabbit
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.