🐛 Fixed admin toolbar adding extra scroll to site pages#28674
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
💤 Files with no reviewable changes (4)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe PR removes the body offset feature from the admin toolbar. The 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin:build |
✅ Succeeded | 14s | View ↗ |
nx run-many -t lint -p @tryghost/admin-toolbar |
✅ Succeeded | 2s | View ↗ |
nx run ghost:build:assets |
✅ Succeeded | 2s | View ↗ |
nx run ghost:build:tsc |
✅ Succeeded | 6s | View ↗ |
nx run-many --target=build --projects=@tryghost... |
✅ Succeeded | 1s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-06-17 15:38:17 UTC
no ref - the toolbar is a position:fixed floating pill, but it reserved padding-bottom on <body> equal to its height + 24px, which inflated the document's scroll height by the bar's height whenever it was active - because the pill floats and never docks as a full-width bar, that reserved space served no purpose and only produced a visible phantom scroll - removed the body offset entirely (body-offset.js, its rAF call in index.js, the now-unused BODY_PADDING_VAR constant, and the related test assertion)
no ref - bumps the package version so CI's public-app version gate passes and the updated bundle is republished to the CDN
446e50d to
19f3cbf
Compare

Describe the problem you are solving
The admin toolbar shown to staff on the frontend is a
position: fixedfloating pill, but on mount it reservedpadding-bottomon<body>equal to its height + 24px. That inflated the document's scroll height by roughly the bar's height, so every page gained a visible chunk of empty scroll whenever the toolbar was active, and it disrupted some theme layouts.Why remove it rather than adjust it
The padding was almost certainly added to stop the fixed toolbar from overlapping page content at the bottom. But the trade-off is lopsided:
?admin=1), can be hidden, and has a minimized mode that shrinks it to a small nub.Trading a guaranteed, universal scroll/layout issue for a rare, escapable cosmetic overlap is the better default, so the offset is removed entirely.
Changelog for devs
apps/admin-toolbar/src/body-offset.js(theapplyBodyOffset/clearBodyOffsethelpers)requestAnimationFramebody-offset call insrc/index.jsBODY_PADDING_VARconstant fromsrc/constants.jstest/admin-toolbar.test.jsChangelog for customers
Notes
bottomcalc and never depended on the offset CSS var, so removing it does not move the toolbar.clearBodyOffsetwas already dead code — it was exported but never imported anywhere, so deleting the whole module is safe.Technical debt
PR Scope (mark all that apply)
Checklist before requesting a review (mark all that apply)