fix: Handle cross-window elements for OverflowTooltip - #4152
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughOverflowTooltip now reads ChangesOverflow Tooltip
Merge Risk: ⚪ Minimal · up to 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: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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
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 usedtarget instanceof HTMLElementagainst the module’s global constructor, which fails for cross-realm elements.The fix introduces
getTargetTextwhich checksinstanceofagainst the element’s ownownerDocument.defaultView.HTMLElement. The tooltip now correctly readsinnerTextfor 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
ready for reviewhas been added to PRFor the Reviewer
Where Should the Reviewer Start?
/modules/react/tooltip/lib/OverflowTooltip.tsx/modules/react/tooltip/spec/OverflowTooltip.spec.tsxAreas for Feedback? (optional)
Testing Manually
window.open().Screenshots or GIFs (if applicable)
N/A