usablica / intro.js

Lightweight, user-friendly onboarding tour library
http://introjs.com
Other
22.8k stars 2.59k forks source link

Resizing the page throws errors #861

Closed plentylife closed 3 years ago

plentylife commented 6 years ago

Description

When resizing the page, there are TypeErrors that are thrown

Expected Behavior

No errors occur

Actual Behavior

This error is thrown Uncaught TypeError: Cannot read property 'style' of null at IntroJs._placeTooltip (index.js:14449) at IntroJs._refresh (index.js:14339) at IntroJs.refresh (index.js:16259) at IntroJs._onResize (index.js:14128) at handler (index.js:15422)

saumilcmarix commented 5 years ago

Hello, I got a strange error if I click on tutorial multiple time, which says Uncaught TypeError: Cannot read property 'setAttribute' of null at IntroJs._showElement (intro.js:1367) at IntroJs._nextStep (intro.js:444) at IntroJs._introForElement (intro.js:270) at IntroJs.start (intro.js:2370).

Please refer screenshot: http://prntscr.com/nz73s6

gp0 commented 4 years ago

I know this an relatively old issue, but i have just run into this. The cause seems to be that _onResize blindly tries to refresh, and if the .introjs-tooltip does not exist, it fails. I've worked around this with by adding the following to the function:

function _onResize () { if (document.querySelector('.introjs-tooltip') !== null) { this.refresh.call(this); } }

robsoncombr commented 4 years ago

Hello, I would like to register that I have also just run into this. On my case it happens inside _refresh():

Uncaught TypeError: Cannot read property 'style' of null at IntroJs._placeTooltip (intro.js?479f:603) at IntroJs._refresh (intro.js?479f:493) at IntroJs.refresh (intro.js?479f:2413) at IntroJs._onResize (intro.js?479f:282) at handler (intro.js?479f:1576) (..)

When it calls the following method with null values since the tooltip does not exist: _placeTooltip.call(this, this._introItems[this._currentStep].element, oldtooltipContainer, oldArrowLayer, oldHelperNumberLayer);

Can we please have this fixed in methods _onResize and _refresh?

Thank you veru much.

jmeinke commented 4 years ago

I can confirm this error.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.