fix(weekly-view): correct slot offset, zero topOffset positioning, and negative clamp#29420
fix(weekly-view): correct slot offset, zero topOffset positioning, and negative clamp#29420ManthanNimodiya wants to merge 2 commits into
Conversation
|
Welcome to Cal.diy, @ManthanNimodiya! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis PR fixes vertical positioning behavior in the weekly calendar view when offset values are zero or negative. The changes replace JavaScript truthy checks with explicit undefined checks to correctly treat zero as a valid offset value rather than a fallback condition. Empty-slot calculations clamp negative offsets to zero, and both Cell and CustomCell components now apply absolute positioning only when topOffsetMinutes is defined. The grid column's marginTop calculation switches to nullish coalescing for consistent zero-value handling. A minor dependency update bumps 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
|
@romitg2 please have a look when you get chance and let me know if any changes are required. |
|
This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active. |
|
@romitg2, please have a look when you get chance also lmk for any changes |
b6cde9a to
e1233d0
Compare
What does this PR do?
Fixes two rendering bugs in the weekly view causing time slot misalignment and content clipping (fixes #14208).
Bug 1: Wrong
marginTopon first renderSchedulerColumnsusedoffsetHeight || "var(--gridDefaultSize)"asmarginTop. On first render the ref is unmeasured (undefined), so the fallback fires. But--gridDefaultSizeis overridden inline to58px(hourSize) while the actual spacer element is28px(--calendar-offset-top). The 30px gap shifts the entire slot grid down — slots don't align with hour labels.Bug 2: Slots at
startHour:00loseposition: absoluteWhen a slot falls at exactly the start of the hour,
topOffsetMinutes === 0. Truthy checks (topOffsetMinutes && "absolute"andtopOffsetMinutes ? ... : undefined) treated0as "no offset", stripping absolute positioning from those slots.Bug 3: Negative
topOffsetMinutesclips slots above the viewportIn timezones behind UTC, a slot's converted local time can fall before
startHour, makingtopOffsetMinutesnegative and pushing slots above the visible grid.Visual Demo (For contributors especially)
Before —


margin-top: 58px: slot grid is pushed 30px below the hour labels. The available slot on THU starts below the 9:00am line with a hatched gap above it.After —


margin-top: 28px: slot grid aligns flush with hour labels. The 9:00am slot starts exactly at the 9:00am line.Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
<ol class="scheduler-grid-row-template">→ confirmmargin-topis28pxnot58pxAmerica/Los_Angeles(UTC-7) and reload — slots should stay within the grid, not clip above itChecklist