Skip to content

fix: prevent visual clipping of irregular WeekRange tooltip #4414

Open
javieryeow wants to merge 4 commits into
nusmodifications:masterfrom
javieryeow:fix/weekRange-tooltip-cutoff
Open

fix: prevent visual clipping of irregular WeekRange tooltip #4414
javieryeow wants to merge 4 commits into
nusmodifications:masterfrom
javieryeow:fix/weekRange-tooltip-cutoff

Conversation

@javieryeow

Copy link
Copy Markdown

Context

closes #4385

irregular WeekRange tooltip in timetable cells was cut off visually, likely due to "interactive" property which made it mount into the reference's parent container. This caused the tooltip to get clipped off at the container boundary instead of just floating freely.

Implementation

fixed the clipping issue by mounting the tooltip to the reference element's ownerDocument root, so that it renders outside the timetable's container, preventing it from being cut off by overflow.

Screenshot 2026-05-25 at 9 24 22 PM

Other Information

Copilot AI review requested due to automatic review settings May 25, 2026 13:42
@vercel

vercel Bot commented May 25, 2026

Copy link
Copy Markdown

@javieryeow is attempting to deploy a commit to the modsbot's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR adjusts how the timetable’s interactive tooltip is mounted so it renders at the document root of the reference element (rather than inside the local container), likely to avoid clipping/stacking issues.

Changes:

  • Add an appendTo handler to mount the tooltip under the reference element’s ownerDocument root.
  • Introduce a helper function (mountToReferenceRoot) used by the tooltip.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread website/src/views/timetable/TimetableCell.tsx Outdated
Comment thread website/src/views/timetable/TimetableCell.tsx Outdated
@codecov

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 56.40%. Comparing base (988c6fd) to head (4ff4f7e).
⚠️ Report is 236 commits behind head on master.

Files with missing lines Patch % Lines
website/src/views/timetable/TimetableCell.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4414      +/-   ##
==========================================
+ Coverage   54.52%   56.40%   +1.87%     
==========================================
  Files         274      317      +43     
  Lines        6076     6964     +888     
  Branches     1455     1680     +225     
==========================================
+ Hits         3313     3928     +615     
- Misses       2763     3036     +273     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jloh02

jloh02 commented Jun 4, 2026

Copy link
Copy Markdown
Member

@greptile

@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a visual clipping bug where the irregular WeekRange tooltip inside timetable cells was cut off at container boundaries. The root cause was that Tippy.js v5 defaults appendTo to "parent" when interactive: true, mounting the tooltip as a sibling of the reference element — inside an overflow-clipped ancestor.

  • Adds a mountToReferenceRoot helper that resolves document.body (with fallbacks to documentElement and the element itself) from a reference element.
  • Passes this function as appendTo to the Tooltip on the irregular week range display, overriding the interactive-induced parent-mount behavior so the tooltip renders freely in the document body.

Confidence Score: 5/5

Safe to merge — the change is a single-line addition to a Tooltip prop, backed by a small, well-bounded helper function with no side effects.

The change touches only one component and one Tooltip instance. The mountToReferenceRoot helper correctly navigates from the reference element to document.body, overriding Tippy.js v5's interactive-mode behavior that was causing the clipping. The fallback chain handles the nullable document.body type safely. No logic outside the tooltip mount target is affected.

No files require special attention.

Sequence Diagram

sequenceDiagram
    participant User
    participant TimetableCell
    participant Tooltip (Tippy)
    participant DOM

    User->>TimetableCell: hover over irregular WeekRange span
    TimetableCell->>Tooltip (Tippy): trigger show (interactive=true)

    alt Before fix (appendTo defaults to parent with interactive)
        Tooltip (Tippy)->>DOM: mount tooltip as sibling inside overflow-clipped ancestor
        DOM-->>User: tooltip visually clipped by container boundary
    end

    alt "After fix (appendTo=mountToReferenceRoot)"
        Tooltip (Tippy)->>DOM: mountToReferenceRoot(ref) returns document.body
        Tooltip (Tippy)->>DOM: mount tooltip into document.body
        DOM-->>User: tooltip renders freely, no clipping
    end
Loading

Reviews (1): Last reviewed commit: "fix: reuse stable mounToReferenceRoot fu..." | Re-trigger Greptile

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.

Irregular weekRange tooltips are cut off

3 participants