Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/components/docPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ export function DocPage({
max-width: none;
box-sizing: border-box;
}
/* At toc breakpoint (1490px), constrain content to leave room for TOC */
@media (min-width: 1490px) {
#doc-content {
/* Calculate max width: viewport - sidebar - TOC - gaps - padding */
/* Leave room for: sidebar (300px) + TOC (250px) + gaps (48px) + padding (96px) */
max-width: calc(100vw - 300px - 250px - 48px - 96px);
Copy link

Choose a reason for hiding this comment

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

Bug: max-width calculation using 100vw includes scrollbar width, causing #doc-content to be too wide and potentially leading to horizontal overflow.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

The max-width calculation for #doc-content uses 100vw, which includes the width of the vertical scrollbar. When a vertical scrollbar is present, this causes the element to be approximately 15px wider than intended, leading to potential horizontal overflow, misalignment of layout elements like the TOC, and possible appearance of a horizontal scrollbar at the 1490px breakpoint.

💡 Suggested Fix

Avoid 100vw for width calculations when scrollbars are a concern. Consider using 100% relative to the parent container, min(100vw - scrollbar_width, ...) if supported, or calculating the available width with JavaScript.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/components/docPage/index.tsx#L138-L142

Potential issue: The `max-width` calculation for `#doc-content` uses `100vw`, which
includes the width of the vertical scrollbar. When a vertical scrollbar is present, this
causes the element to be approximately 15px wider than intended, leading to potential
horizontal overflow, misalignment of layout elements like the TOC, and possible
appearance of a horizontal scrollbar at the `1490px` breakpoint.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference_id: 2811448

}
}
Copy link

Choose a reason for hiding this comment

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

Bug: Undefined CSS variable breaks sidebar positioning

The CSS at the 2057px breakpoint references var(--sidebar-width) which is never defined in the stylesheet, causing the left sidebar positioning calculation to fail. This would result in the sidebar not being positioned correctly at large viewports.

Fix in Cursor Fix in Web

Copy link

Choose a reason for hiding this comment

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

Bug: Incorrect padding value in width calculation

The media query calculation assumes 96px of horizontal padding, but the #doc-content element only has 48px from the px-6 Tailwind class (24px per side). This mismatch will cause the content to be constrained narrower than intended, reducing available space within the 1490px-2056px viewport range.

Fix in Cursor Fix in Web

@media (min-width: 2057px) {
:root {
--doc-content-w: 1100px;
Expand Down
Loading