-
Notifications
You must be signed in to change notification settings - Fork 10
fix(test): feature detection for IntersectionObserver #4378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(test): feature detection for IntersectionObserver #4378
Conversation
…h-react-testing-library
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes feature detection for IntersectionObserver in several UI components to ensure that the observer is only instantiated in environments where it is available.
- Added runtime checks for IntersectionObserver in tooltip, popover, and custom-select components.
- Ensured that observer initialization is conditioned on window availability and presence of IntersectionObserver.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
packages/components/src/components/tooltip/tooltip.lite.tsx | Added feature detection block for IntersectionObserver. |
packages/components/src/components/popover/popover.lite.tsx | Added feature detection block for IntersectionObserver. |
packages/components/src/components/custom-select/custom-select.lite.tsx | Added feature detection block for IntersectionObserver. |
Comments suppressed due to low confidence (2)
packages/components/src/components/tooltip/tooltip.lite.tsx:120
- Consider adding cleanup logic to disconnect the observer when the component unmounts to prevent potential memory leaks if this is not already handled elsewhere.
if (typeof window !== 'undefined' && 'IntersectionObserver' in window) {
packages/components/src/components/popover/popover.lite.tsx:133
- Ensure that the observer is properly disconnected during cleanup to avoid any lingering observers after the component unmounts.
if (typeof window !== 'undefined' && 'IntersectionObserver' in window) {
…h-react-testing-library
Proposed changes
Resolves #4370
Types of changes
Further comments