fix(hud): keep the bar in place across a vertical↔horizontal flip - #953
Conversation
Switching the bar to vertical and back left it about 130 DIP higher each round trip (Windows 11, 125 %). Right after hud-overlay-set-size the ResizeObserver fires again while the old viewport is still laid out, so the hud-overlay-content that follows carries a rect measured in the window the main process has just replaced. The main process stores it as the anchor, and the next flip re-anchors the window on it: the window keeps its top-left instead of the bar's bottom-centre. The stack is always centred and pinned HUD_BAR_BOTTOM above the bottom edge, which is how grantedContent is already computed. The reported rect now uses the same formula on the allocated size, and only its size comes from the measurement. Fixes #951
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Repository guideline files applied to this review (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe HUD content rectangle now derives its position from the allocated window size. The test checks the stack’s centered horizontal position and bottom-anchored vertical position against the latest allocation. ChangesHUD resize positioning
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The HUD reports content bounds from the latest window allocation, and no actionable merge risk remains. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change is limited to recording-bar positioning and does not expand permissions or external access. No new security issue was identified. Recovery when a requested resize is not applied remains unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Summary
Switching the recording bar to the vertical layout and back no longer walks it up the screen.
Right after
hud-overlay-set-size, the HUD'sResizeObserverfires again while the old viewport is still laid out. Thehud-overlay-contentreport that follows therefore carried a stack rect measured in the window the main process had just replaced, and the main process stored it as the anchor. The next flip re-anchored on that stale rect: the window kept its top-left instead of the bar's bottom-centre, and the bar moved up by about 130 DIP each round trip.The stack is always centred and pinned
HUD_BAR_BOTTOMabove the bottom edge, which is already howgrantedContentis computed. The reported rect now uses the same formula on the allocated size. Only its size still comes from the measurement.Related issue
Fixes #951
Type of change
Release impact
Desktop impact
Linux is unaffected: there the main process ignores the content rect (
HUD_CLAMPS_CONTENT).Testing
Root cause. Hooked
hud-overlay-set-sizeandhud-overlay-contentin the main process of the packaged 2.0.0-rc.1 build (--inspect). The stale report[427,99,54,577]arrives right afterset-size 648×826; it is the vertical bar centred in the old 908×697 window. The next flip lands exactly on the drifted bounds432,19.After the fix, dev build, same hooks, Windows 11 at 125 %, two vertical↔horizontal round trips:
316,149 908×697302,149 937×697302,149 937×697x moves from 316 to 302 only because the bar widened; it stays centred on the same point. No stale content report arrives any more.
The flips were driven by DOM clicks on the layout button. The drift reproduced the same way on the unfixed rc.1 build, so the comparison holds, but this is not a check that the button is reachable with a real pointer.
Regression test.
LaunchWindow.test.tsx› "reports an opened popover as part of the rect kept on screen" now expects the rect computed from the allocation, not the stubbed(0, 0). It fails with the fix reverted.npx tsc --noEmitandnpx tsc -p tsconfig.test.json --noEmitpass;npm run test: 4023 passed.Summary by CodeRabbit