Skip to content

fix: Handle cross-window elements for OverflowTooltip - #4152

Open
jjbubudi wants to merge 1 commit into
Workday:masterfrom
jjbubudi:overflow-tooltip-fix
Open

fix: Handle cross-window elements for OverflowTooltip#4152
jjbubudi wants to merge 1 commit into
Workday:masterfrom
jjbubudi:overflow-tooltip-fix

Conversation

@jjbubudi

@jjbubudi jjbubudi commented Aug 23, 2026

Copy link
Copy Markdown

Summary

Fixes: #4151

OverflowTooltip returned empty tooltip text when the target element comes from a different Window realm, e.g. an element rendered in a window opened via window.open() or inside an iframe. The component used target instanceof HTMLElement against the module’s global constructor, which fails for cross-realm elements.

The fix introduces getTargetText which checks instanceof against the element’s own ownerDocument.defaultView.HTMLElement. The tooltip now correctly reads innerText for cross-realm targets.

Release Category

Components

Release Note

OverflowTooltip now correctly displays text for targets rendered in a different window/iframe context, such as pages opened via window.open().

Checklist

  • MDX documentation adheres to Canvas Kit's Documentation Guidelines
  • Label ready for review has been added to PR

For the Reviewer

  • PR title is short and descriptive
  • PR summary describes the change
  • PR Release Notes describes additional information
  • Breaking Changes provides useful information or removed

Where Should the Reviewer Start?

/modules/react/tooltip/lib/OverflowTooltip.tsx
/modules/react/tooltip/spec/OverflowTooltip.spec.tsx

Areas for Feedback? (optional)

  • Code
  • Documentation
  • Testing
  • Codemods

Testing Manually

  1. Open a page in a new window via window.open().
  2. Render OverflowTooltip with an overflowed target.
  3. Hover – tooltip now shows the target text instead of being blank.

Screenshots or GIFs (if applicable)

N/A

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 78137d2c-f145-41bb-b72b-cfaf58f86beb

📥 Commits

Reviewing files that changed from the base of the PR and between 19b3f13 and b45bddd.

📒 Files selected for processing (2)
  • modules/react/tooltip/lib/OverflowTooltip.tsx
  • modules/react/tooltip/spec/OverflowTooltip.spec.tsx

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

OverflowTooltip now reads innerText through the target element’s owning window. Tests cover tooltip text for overflowed targets in the main document and an iframe.

Changes

Overflow Tooltip

Layer / File(s) Summary
Realm-safe tooltip text handling
modules/react/tooltip/lib/OverflowTooltip.tsx, modules/react/tooltip/spec/OverflowTooltip.spec.tsx
The tooltip handlers use a local getInnerText helper with the target’s owning window. Tests verify tooltip text in standard and iframe document realms.
Estimated code review effort: 2 (Simple) ~10 minutes

Merge Risk: ⚪ Minimal · up to b45bd

OverflowTooltip now reads text correctly for targets from another window or iframe; the localized implementation and tests leave no actionable merge-blocking risk beyond normal checks and review.

Suggested reviewers: billgeoghegan, alanbsmith

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix for handling OverflowTooltip targets from different window realms.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jjbubudi jjbubudi changed the title fix: handle cross-window elements for OverflowTooltip fix: Handle cross-window elements for OverflowTooltip Aug 23, 2026
@jjbubudi
jjbubudi marked this pull request as ready for review August 23, 2026 08:15
@jjbubudi
jjbubudi requested a review from a team as a code owner August 23, 2026 08:15
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.

Overflow tooltip shows empty text when used in a popup window

1 participant