Skip to content

fix(docs): dropdown bg in dark mode, MCP sidebar sync, Safari copy#6402

Merged
Alek99 merged 1 commit intomainfrom
alek/docs-mcp-and-copy-fixes
Apr 28, 2026
Merged

fix(docs): dropdown bg in dark mode, MCP sidebar sync, Safari copy#6402
Alek99 merged 1 commit intomainfrom
alek/docs-mcp-and-copy-fixes

Conversation

@Alek99
Copy link
Copy Markdown
Member

@Alek99 Alek99 commented Apr 28, 2026

Summary

Three small docs-site bugs found while reviewing /docs/ai-builder/integrations/mcp-overview/, plus a dropdown cleanup.

  • Transparent dropdown in dark mode. --c-slate-1 was missing from the dark-theme block in custom-colors.css (only an orphan comment marked the slot). Tailwind's bg-slate-1 resolves through --color-slate-1var(--c-slate-1), which fell back to transparent in dark mode. Affects every bg-slate-1 surface; most visible on the copy-page popover.
  • Sidebar didn't sync on direct MCP navigation. Loading /docs/ai-builder/integrations/mcp-* directly fell through to sidebar_index = 0 (AI Builder), so the MCP category wasn't selected. Clicking MCP first worked because the click handler set _sidebar_index = 1. Added an /mcp- branch to SidebarState.sidebar_index.
  • Copy-page button broken on Safari. The previous code did fetch(mdUrl).then(text => navigator.clipboard.writeText(text)). By the time writeText ran, Safari's user-gesture window had closed and the call was rejected. Chrome was lenient and allowed it. Switched to navigator.clipboard.write([new ClipboardItem({ 'text/plain': blobPromise })]) — calling write synchronously with a Promise-backed ClipboardItem preserves the gesture binding in both browsers.
  • Removed llms-full.txt from the copy-page dropdown.

Test plan

  • In dark mode, open the copy-page dropdown — background is solid (#151618).
  • Hard-refresh on /docs/ai-builder/integrations/mcp-overview/ — sidebar shows MCP category selected and the MCP Integration accordion expanded.
  • In Safari, click the copy-page button — page markdown lands in clipboard.
  • In Chrome, click the copy-page button — same.
  • Confirm the llms-full.txt row no longer appears in the dropdown.

🤖 Generated with Claude Code

- Add missing --c-slate-1 dark-mode definition in custom-colors.css; bg-slate-1
  resolves through this var, which was undefined in dark mode and caused the
  copy-page popover (and any other bg-slate-1 surface) to render transparent.
- In SidebarState.sidebar_index, route MCP doc paths to index 1 so the MCP
  category is selected when landing directly on /docs/ai-builder/integrations/mcp-*.
- Fix copy-page button on Safari: rewrite to use navigator.clipboard.write with
  a ClipboardItem whose data is a Promise. Calling clipboard.write synchronously
  inside the click handler preserves Safari's user-gesture requirement; the
  prior fetch().then(writeText) chain only worked in Chromium.
- Remove the llms-full.txt entry from the copy-page dropdown.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Alek99 Alek99 requested a review from a team as a code owner April 28, 2026 02:41
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 28, 2026

Greptile Summary

Three focused docs-site bug fixes: adds the missing --c-slate-1 CSS variable in the dark-theme block (transparent dropdown background), adds an /mcp- branch to SidebarState.sidebar_index so direct navigation selects the correct sidebar, and rewrites the copy-page clipboard logic to use ClipboardItem with a Promise-backed blob to preserve Safari's user-gesture window. The llms-full.txt dropdown entry is also removed.

Confidence Score: 4/5

Safe to merge — all three fixes are targeted and correct, with only minor style-level concerns.

No P0 or P1 findings. Two P2s: the /mcp- substring match is slightly broad (easily tightened later), and the textarea fallback was silently removed from the writeText error path. Neither affects correctness for the targeted browsers.

No files require special attention; the sidebar state change and clipboard rewrite are both straightforward.

Important Files Changed

Filename Overview
docs/app/assets/custom-colors.css Replaces orphan /* #151618 */ comment with the missing --c-slate-1: #151618 CSS variable in the dark-theme block — correct fix.
docs/app/reflex_docs/templates/docpage/sidebar/state.py Adds /mcp- route branch to sidebar_index computed var so direct navigation to MCP pages selects the correct sidebar; pattern is a broad substring match that could match unintended future routes.
docs/app/reflex_docs/templates/docpage/docpage.py Rewrites clipboard logic to use ClipboardItem with a blob Promise (preserving gesture binding for Safari); removes llms-full.txt menu item; drops the textarea fallback from the writeText catch path.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User clicks Copy button] --> B[animate icons]
    B --> C{ClipboardItem available?}
    C -- Yes --> D[Create blobPromise via fetch]
    D --> E[navigator.clipboard.write with ClipboardItem]
    E --> F{Success?}
    F -- No --> G[console.error]
    F -- Yes --> H[Text in clipboard]
    C -- No --> I[fetch mdUrl]
    I --> J{navigator.clipboard.writeText?}
    J -- Yes --> K[writeText text]
    J -- No --> L[textarea execCommand fallback]
    K --> H
    L --> H
Loading

Reviews (1): Last reviewed commit: "fix(docs): dropdown bg in dark mode, MCP..." | Re-trigger Greptile

Comment thread docs/app/reflex_docs/templates/docpage/sidebar/state.py
Comment thread docs/app/reflex_docs/templates/docpage/docpage.py
Comment thread docs/app/reflex_docs/templates/docpage/docpage.py
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 28, 2026

Merging this PR will not alter performance

✅ 9 untouched benchmarks


Comparing alek/docs-mcp-and-copy-fixes (5f2fbc9) with main (e6e3784)

Open in CodSpeed
Comment thread docs/app/reflex_docs/templates/docpage/sidebar/state.py
Copy link
Copy Markdown
Contributor

@picklelo picklelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice working for me

@Alek99 Alek99 merged commit 3fdcaf4 into main Apr 28, 2026
69 checks passed
@Alek99 Alek99 deleted the alek/docs-mcp-and-copy-fixes branch April 28, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants