-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Expected behavior
addEventListener
and removeEventListener
should only be callable on valid defined and non-null elements.
Current behavior
TypeError: Cannot read properties of null (reading 'addEventListener')
at addListener(../../node_modules/chart.js/dist/chart.js:3234:8)
at createProxyAndListen(../../node_modules/chart.js/dist/chart.js:3360:15)
at DomPlatform.addEventListener(../../node_modules/chart.js/dist/chart.js:3406:21)
at _add(../../node_modules/chart.js/dist/chart.js:6216:16)
at <anonymous>(../../node_modules/chart.js/dist/chart.js:6224:41)
at each(../../node_modules/chart.js/dist/chunks/helpers.segment.js:56:12)
at _a.bindUserEvents(../../node_modules/chart.js/dist/chart.js:6224:10)
at _a.bindEvents(../../node_modules/chart.js/dist/chart.js:6205:10)
at _a._checkEventBindings(../../node_modules/chart.js/dist/chart.js:5903:12)
at _a.update(../../node_modules/chart.js/dist/chart.js:5852:10)
at this._doResize(../../node_modules/chart.js/dist/chart.js:5620:46)
at sentryWrapped(../../node_modules/@sentry/browser/esm/helpers.js:37:17)
From sentry:

Reproducible sample
.
Optional extra steps/info to reproduce
No response
Possible solution
Here is what I am proposing: DAcodedBEAT@8930d19
Context
-
I've seen a few related errors in other implementations according their Github issues
-
I made a new Github issue since Cannot read properties of null (reading 'addEventListener') #11295 (comment) has been ignored for 3 weeks
-
I didn't make the Pull Request since https://github.com/chartjs/Chart.js/blob/master/docs/developers/contributing.md advised against it but I made this issue since I was redirected from the discord chat to here (after the first inquiry was ignored)
chart.js version
4.4.1
Browser name and version
Chrome >=120 and Edge >= 120 according to my project's Sentry, but probably many others
Link to your project
No response