Skip to content
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

On mobile onToggle triggers as many times as there are Tooltips #77

Open
bekju opened this issue Feb 12, 2020 · 2 comments
Open

On mobile onToggle triggers as many times as there are Tooltips #77

bekju opened this issue Feb 12, 2020 · 2 comments

Comments

@bekju
Copy link

bekju commented Feb 12, 2020

{contents.map(contentInfo => <Tooltip
   content={<ContentTooltip content={contentInfo} />}
   className='tooltip-wrapper'
   onToggle={e => loadInfo()}
>)}

I have 80 Tooltip elements on a page and on desktop it works fine, onToggle triggers only when hovering over and leaving the hover, but on mobile anywhere I touch on a document it triggers onToggle 80 times, which causes re-render and browser lag. From looking at the code I see that bodyTouchStart(e) triggers hideTip everytime I touch the body.
Even if loadInfo() is a function that only does console.log() or even nothing it causes performance issues. Am I doing something wrong?

Also is there possible to add a prop (or a way I could add it myself) to load the tooltip only on desktop? I don't need it for touch devices.

@bekju bekju changed the title On mobile onToggle triggers as many times as there are tooltip-wrappers On mobile onToggle triggers as many times as there are Tooltips Feb 12, 2020
@bsidelinger912
Copy link
Owner

Hey @bekju I think I see what's going on here. Sorry for the lag in getting to this, I'm looking at it now.

@oosharma
Copy link

I am facing the exact same issue. @bsidelinger912 , were you able to find any solution for this?

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

No branches or pull requests

3 participants