-
Notifications
You must be signed in to change notification settings - Fork 8
fix(website): Make custom tooltips clickable on mobile #6427
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
base: main
Are you sure you want to change the base?
Changes from all commits
e84024d
130715b
0821ee7
60a0d1c
c9c0cd0
a6a45b9
aad76ac
59d096d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,12 +1,19 @@ | ||||||||||||
| import type { ComponentProps, FC } from 'react'; | ||||||||||||
| import { Tooltip } from 'react-tooltip'; | ||||||||||||
|
|
||||||||||||
| export const CustomTooltip: FC<ComponentProps<typeof Tooltip>> = ({ className, ...props }) => ( | ||||||||||||
| export const CustomTooltip: FC<ComponentProps<typeof Tooltip>> = ({ className, ...props }) => { | ||||||||||||
| const isTouchOnly = typeof window !== 'undefined' && window.matchMedia('(pointer: coarse)').matches; | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This runs during render and causes an SSR/hydration mismatch in Astro — the server renders with
Suggested change
And update the import to
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't cause a SSR issue as far as I understand, as
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I think it's because the tooltip isn't rendered until you mouseover |
||||||||||||
|
|
||||||||||||
| // Set positionStrategy and z-index to make the Tooltip float above the ReviewPage toolbar | ||||||||||||
| <Tooltip | ||||||||||||
| positionStrategy='fixed' | ||||||||||||
| place='right' | ||||||||||||
| className={`z-20 max-w-sm whitespace-pre-wrap break-words ${className ?? ''}`} | ||||||||||||
| {...props} | ||||||||||||
| /> | ||||||||||||
| ); | ||||||||||||
| return ( | ||||||||||||
| <Tooltip | ||||||||||||
| positionStrategy='fixed' | ||||||||||||
| place='right' | ||||||||||||
| className={`z-20 max-w-sm whitespace-pre-wrap break-words ${className ?? ''}`} | ||||||||||||
| openEvents={{ mouseenter: !isTouchOnly, click: isTouchOnly, focus: false }} | ||||||||||||
| closeEvents={{ mouseleave: !isTouchOnly, click: isTouchOnly, blur: true }} | ||||||||||||
| globalCloseEvents={{ clickOutsideAnchor: true, scroll: true }} | ||||||||||||
| {...props} | ||||||||||||
| /> | ||||||||||||
| ); | ||||||||||||
| }; | ||||||||||||
Uh oh!
There was an error while loading. Please reload this page.