Skip to content

Update media queries to avoid horizontal scroll when side menu appears#17694

Open
coolguyzone wants to merge 1 commit intomasterfrom
coolguyzone/fix/scroll-bug
Open

Update media queries to avoid horizontal scroll when side menu appears#17694
coolguyzone wants to merge 1 commit intomasterfrom
coolguyzone/fix/scroll-bug

Conversation

@coolguyzone
Copy link
Copy Markdown
Contributor

@coolguyzone coolguyzone commented May 8, 2026

See https://sentry-docs-git-coolguyzone-fixscroll-bug.sentry.dev/platforms/android/logs/ at widths 1490+, there shouldn't be any more horizontal scrolling.

DESCRIBE YOUR PR

Tell us what you're changing and why. If your PR resolves an issue, please link it so it closes automatically.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

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

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment May 8, 2026 8:23pm
sentry-docs Ready Ready Preview, Comment May 8, 2026 8:23pm

Request Review

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 54d938b. Configure here.

#doc-content {
max-width: calc(100vw - var(--sidebar-width, 300px) - var(--toc-w) - 2rem);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Media query shrinks content on pages without TOC

Medium Severity

The new media query unconditionally subtracts --toc-w (250px) from #doc-content max-width, but the TOC sidebar is only rendered when hasToc is true (line 63). On pages where hasToc is false (e.g., pages with notoc: true in frontmatter and no platform/guide), the content area is unnecessarily narrowed by 250px in the 1490–1649px viewport range, even though no TOC is taking up space.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 54d938b. Configure here.

Comment on lines +169 to +173
@media (min-width: 1490px) and (max-width: 1649px) {
#doc-content {
max-width: calc(100vw - var(--sidebar-width, 300px) - var(--toc-w) - 2rem);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: The new media query for #doc-content unconditionally subtracts the TOC width, even on pages without a TOC, causing a large empty gap on the right.
Severity: MEDIUM

Suggested Fix

The CSS rule that subtracts var(--toc-w) should only be applied when the Table of Contents is actually present. Consider adding a class like has-toc to a parent element when hasToc is true, and then scope the new CSS rule to that class (e.g., .has-toc #doc-content { ... }). This will ensure the layout adjustment only happens when needed.

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#L169-L173

Potential issue: A new CSS media query for viewports between 1490px and 1649px
unconditionally subtracts `var(--toc-w)` (250px) from the `max-width` of the
`#doc-content` element. This rule is applied even when the Table of Contents is not
rendered (when `hasToc` is `false`), such as on pages with `notoc=true`. This results in
the main content area being unnecessarily narrow, leaving a large blank gap on the
right. This also incorrectly constrains pages with `fullWidth=true` due to the CSS ID
selector's higher specificity.

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

Copy link
Copy Markdown
Contributor

@sfanahata sfanahata left a comment

Choose a reason for hiding this comment

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

It works okay, but would be good to check out the bot feedback before merging @coolguyzone

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.

2 participants