svelte-material-ui
svelte-material-ui copied to clipboard
Tooltip: when go to another route, got null error
Describe the bug
Added a <Tooltip>
, when goto another route by clicking an icon, got following error in console:
Tooltip.svelte:180 Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
at Object.registerEventHandler (Tooltip.svelte:180:23)
at MDCTooltipFoundation2.show (foundation.ts:403:20)
at foundation.ts:201:14
registerEventHandler @ Tooltip.svelte:180
MDCTooltipFoundation2.show @ foundation.ts:403
(anonymous) @ foundation.ts:201
setTimeout (async)
MDCTooltipFoundation2.handleAnchorMouseEnter @ foundation.ts:200
handleAnchorMouseEnter
Desktop (please complete the following information):
- OS: Linux
- Browser: Chrome 104.0.5112.79 (Official Build) (64-bit)
- Version:
6.1.3
Maybe in Tooltip.svelte
, should change to:
registerEventHandler: (evt, handler) => {
getElement().addEventListener(evt, handler);
},
to
registerEventHandler: (evt, handler) => {
getElement()?.addEventListener(evt, handler);
},
I'm not sure.
Having the same issue:
Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
at Object.registerEventHandler (@smui_tooltip.js?v=7894914c:2034:21)
at MDCTooltipFoundation2.show (@smui_tooltip.js?v=7894914c:510:22)
at @smui_tooltip.js?v=7894914c:385:17
If click the button before the tooltip appears.