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

Latest update broke canvas mouse interaction #2162

Closed
jsnns opened this issue Oct 13, 2022 · 18 comments
Closed

Latest update broke canvas mouse interaction #2162

jsnns opened this issue Oct 13, 2022 · 18 comments

Comments

@jsnns
Copy link

jsnns commented Oct 13, 2022

Canvas charts log an error on mouse move. Can be reproduced on nivo.rocks just by choosing a canvas and hovering over the chart.

Uncaught TypeError: t.getBBox is not a function

Device info:
MacBook Pro — running macOS Monterey 12.5
Mac Pro — running macOS Monterey 12.5

Screen Shot 2022-10-12 at 6 46 00 PM

Screen Shot 2022-10-12 at 6 46 41 PM

@shehi
Copy link

shehi commented Oct 15, 2022

+1 Yes, I just started to have the same problem after upgrading to React 18.

Is this related to #2122 ?

@jamie-brown-cc
Copy link

This also breaks tooltips - the tooltips do not render on the canvas charts on version 0.80.o either.

@baruchiro
Copy link

I think this is the problematic code (from 0.80.0):

const box = el.getBBox()

And it seems to be fixed by #2125:

if (el.getBBox !== undefined) {
// For SVG elements.
originalBox = el.getBBox()
} else {

@plouc consider closing this issue?

@TheOGRafiki
Copy link

any updates?

@antonmikhaliou
Copy link

Anybody here? Rlly need this fix

@ErwinJapie
Copy link

Would be nice if this could be fixed, the package is unusable now with latest (18) react version

@pieterseeder
Copy link

@ErwinJapie i encounter the same issue. this is really problematic.

@shehi
Copy link

shehi commented Jan 20, 2023

I don't mean disrespect, but I hope nothing has happened to @plouc :( The issues of past 6 months piled up so badly, and zero comment from him to any of those - very disconcerting!

AKaudinov pushed a commit to reaktor/pluspool-led that referenced this issue Jan 30, 2023
- Updated the graph title circle to not have a negative margin
  so it doesn't overflow out of the sticky date filter container element
  when scrolling
- Updated the native radio button to not have a display of 'none', but
  instead be absolute, hidden and with opacity of 0. This keeps the
  date filters tabbale through tab roving. Added radiogroup role to the
  date filter container
- Downgraded nivo core and nivo line to 0.79.0 as version 0.80.0 breaks
  mouse and tooltip interaction for canvas charts. More on this, here: plouc/nivo#2162
@ansgarsteinkamp
Copy link

Same problem here. Nivo is unusable now regarding canvas-components.

@ShavaShav
Copy link

Same here. Really wish I could use ResponseLiveCanvas for a chart with many points, but the tooltips don't show due to this issue.

@sighrobot
Copy link

+1 to above (I tried a workaround but was foiled by lerna/lerna#2074)

@sighrobot
Copy link

OK! Here's a workaround that I just tested! Seems like it might unblock some of you. You can shim HTMLCanvasElement.prototype.getBBox somewhere in your application, ideally before your canvas visualization is instantiated:

HTMLCanvasElement.prototype.getBBox = function () {
  return { width: this.offsetWidth, height: this.offsetHeight };
};

For my use case in Next.js, I wrapped it in an effect hook to run once on the client:

React.useEffect(() => {
  HTMLCanvasElement.prototype.getBBox = function () {
    return { width: this.offsetWidth, height: this.offsetHeight };
  };
}, []);

This is almost identical to the fix in #2125. Just use with care until we see a version bump 🥲

@shehi
Copy link

shehi commented Apr 7, 2023

@sighrobot : Works, thanks. Sadly, @plouc merged #2125 right after 0.80 release, so it isn't part of any release.

@meessour
Copy link

This issue has been fixed when updating to v0.82.0

@shehi
Copy link

shehi commented Jun 15, 2023

This issue has been fixed when updating to v0.82.0

0.82 isn't installable :) We all are stuck with 0.80 or 0.81, I don't even remember.

@meessour
Copy link

This issue has been fixed when updating to v0.82.0

0.82 isn't installable :) We all are stuck with 0.80 or 0.81, I don't even remember.

hmmm, that's strange. My packages are all up to date without a problem:

"@nivo/bar": "^0.83.0",
"@nivo/bullet": "^0.83.0",
"@nivo/core": "^0.83.0",
"@nivo/funnel": "^0.83.0",
"@nivo/line": "^0.83.0",

@ErwinJapie
Copy link

I installed v0.83.0 today and can confirm the issue is fixed 🎉

@plouc plouc closed this as completed Jun 16, 2023
@shehi
Copy link

shehi commented Jun 18, 2023

Not installable due to #2310.

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