Skip to content

Conversation

@codyde
Copy link
Contributor

@codyde codyde commented Sep 11, 2025

fix(toc): prevent right ToC from shrinking; enforce 250px min width

Context

  • Right-hand ToC width (set to 250px) was shrinking in the flex layout between the 'toc' breakpoint (1490px) and the ultra-wide breakpoint (2057px), especially visible when Session Replay UI alters available width.
  • Additionally, some pages had extremely long, unbroken content inside code blocks (e.g., long URLs/paths/tokens). When code options changed, these long lines could expand the content column and indirectly squeeze the ToC.

Changes

  • ToC: Make the a non-shrinking flex item and enforce a minimum width.
    • Updated src/components/docPage/index.tsx ToC aside classes from hidden toc:block w-[250px] to hidden toc:block flex-none w-[250px] min-w-[250px].
  • Code wrapping: Wrap long lines inside code blocks so they don’t expand layout.
    • Updated src/components/codeBlock/code-blocks.module.scss to apply:
      • white-space: pre-wrap;, word-break: break-word;, overflow-wrap: anywhere; on pre and pre[class*='language-'].
      • Same wrapping rules on .code-line to preserve highlight behavior.
      • max-width: 100%; and tab-size: 2; on pre.
  • Main content flex: Allow the main content column to shrink within the flex layout.
    • Added min-w-0 to the #doc-content container in src/components/docPage/index.tsx.

Result

  • When the ToC is visible, it remains a fixed 250px and does not compress due to layout shifts.
  • Long code no longer forces the content area to expand; lines wrap within the available width.
  • Existing responsive behavior remains unchanged: ToC hidden below the toc breakpoint; pinned/fixed layout ≥2057px.

Files

  • src/components/docPage/index.tsx
  • src/components/codeBlock/code-blocks.module.scss

@vercel
Copy link

vercel bot commented Sep 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
develop-docs Ready Ready Preview Comment Sep 11, 2025 5:34am
sentry-docs Ready Ready Preview Comment Sep 11, 2025 5:34am

@codecov
Copy link

codecov bot commented Sep 11, 2025

Bundle Report

Changes will increase total bundle size by 805 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-client-array-push 9.91MB 93 bytes (0.0%) ⬆️
sentry-docs-server-cjs 12.61MB 712 bytes (0.01%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 882.71kB -0.0%
static/css/*.css 254 bytes 19.42kB 1.33%
static/css/*.css 129 bytes 746.05kB 0.02%
static/chunks/8321-*.js -3 bytes 425.87kB -0.0%
static/media/7c239973d8aef789-*.woff2 (New) 32.56kB 32.56kB 100.0% 🚀
static/media/32c80fb7588b7a2e-*.woff2 (New) 32.48kB 32.48kB 100.0% 🚀
static/media/a5d9f2ead0568494-*.woff2 (New) 21.08kB 21.08kB 100.0% 🚀
static/media/5b25d60b4670300e-*.woff2 (New) 19.29kB 19.29kB 100.0% 🚀
static/media/fc5b975a09123a00-*.woff2 (New) 9.75kB 9.75kB 100.0% 🚀
static/media/99e31c27a1524300-*.woff2 (New) 9.35kB 9.35kB 100.0% 🚀
server/middleware-*.js -5.55kB 1.0kB -84.74%
server/middleware-*.js 5.55kB 6.55kB 555.3% ⚠️
static/mEK6K9nhMw9Q0frwWxLU0/_buildManifest.js (New) 684 bytes 684 bytes 100.0% 🚀
static/mEK6K9nhMw9Q0frwWxLU0/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/media/4fca85807f6c09f6-*.woff2 (Deleted) -32.6kB 0 bytes -100.0% 🗑️
static/media/d695df15e3ff125c-*.woff2 (Deleted) -32.58kB 0 bytes -100.0% 🗑️
static/media/acdf4f392b58827a-*.woff2 (Deleted) -21.13kB 0 bytes -100.0% 🗑️
static/media/501d9eeee6e2b0cc-*.woff2 (Deleted) -19.41kB 0 bytes -100.0% 🗑️
static/media/a72efd2c2476ebb2-*.woff2 (Deleted) -9.7kB 0 bytes -100.0% 🗑️
static/media/9d7436bc73437f75-*.woff2 (Deleted) -9.36kB 0 bytes -100.0% 🗑️
static/9HlYUcSAuH4-*.js (Deleted) -684 bytes 0 bytes -100.0% 🗑️
static/9HlYUcSAuH4-*.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️
view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.78MB -0.0%
../instrumentation.js -3 bytes 1.1MB -0.0%
9523.js -3 bytes 1.08MB -0.0%
../app/[[...path]]/page.js.nft.json 227 bytes 804.83kB 0.03%
../app/platform-redirect/page.js.nft.json 227 bytes 804.75kB 0.03%
../app/sitemap.xml/route.js.nft.json 227 bytes 802.22kB 0.03%
4873.js 40 bytes 91.14kB 0.04%

Files in 4873.js:

  • ./src/components/docPage/index.tsx → Total Size: 10.88kB

@codyde codyde merged commit 316c765 into master Sep 11, 2025
15 checks passed
@codyde codyde deleted the fix/toc-non-shrinking branch September 11, 2025 05:36
@github-actions github-actions bot locked and limited conversation to collaborators Sep 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants