-
Notifications
You must be signed in to change notification settings - Fork 290
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
[Question] Best practices for implementing tooltips #48
Comments
We've been struggling with this problem as well. The solution is to have overflow disabled per cell, set rowsContainer to allow visible, and have classes for cells that have the tooltip.
One glitch we encounter is our tooltip closing animation being cut off when the user moves to a different row. Because of cell recycling, theres no obvious solution here. |
Try using |
Closing unless theres any follow up |
@KamranAsif - I tried to use your method but it seemed a little bit too much (there are a lot of edge cases, and it felt too volatile). I decided to look for solutions where the tooltip element lives outside of the table, so you don't have to 'fight' the table via css and don't carry stuff on your back 🐫. I used https://github.com/wwayne/react-tooltip, and it works pretty well - I had to fix some issues related to the fact the table uses transforms (ReactTooltip/react-tooltip#195) - it was a minor bug. But other than that - you just put the tooltip element outside the table and it makes your life much easier. |
Definitely the best approach. Thanks for the reply, I'm sure others will benefit! |
A tooltip example using react-tooltip is now available here: |
I've been trying to use react-tooltip with this table and I'm running into some issues. I can get the react-tooltip to work with other basic react components just fine, however it fails with this table for some reason. In the example, class TooltipCell extends React.PureComponent {
render() {
const {data, rowIndex, columnKey, ...props} = this.props;
const value = data.getObjectAt(rowIndex)[columnKey];
return (
<Cell
{...props}
onMouseEnter={() => { ReactTooltip.show(); }}
onMouseLeave={() => { ReactTooltip.hide(); }}>
<div ref='valueDiv' data-tip={value}>
{value}
</div>
</Cell>
);
}
}; Why were the |
Also it looks like the example is broken. The first 15 rows have tooltips, but rows 16 to 27 do not have tool tips, even though from the code it looks like they are supposed. Could this have something to do with the DOM nodes being recycled. But if I scroll to rows 16 to 27, then call |
The example seems to work fine for me. You likely have a bug in your own code. |
@KamranAsif here's a gif of your tooltip example online, not my code. I suppose it could be something specific to my browser, but I doubt it. AFAIK if you just scroll a have a page down the table, then the rows no longer have tooltips. So rows that do not fit into the initial render, NOT a specific number of rows. Anyway this issue went away when I called |
Hi,
I'm trying to use the table with cells that you can hover on them and see tooltips. Because of overflow/z-indexing issues I see my tooltips being clipped, and I see other issues with recycling of cells (for example, using https://github.com/wwayne/react-tooltip with a single
<ReactTooltip />
wouldn't work out of the box).The text was updated successfully, but these errors were encountered: