Page 1 of 1

scrollIntoView in onEnteringState on page refresh

Posted: 10 November 2020, 17:25
by Ilmion
Hello, I have difficulties making scrollIntoView work when refreshing the page (F5) on when coming back to a the table.
But, when the active player trigger the state change, the scroll work.

Here is my code in the switch case of the onEnteringState function of my .js file.

Code: Select all

                
       case 'progress':                    
             if (this.isCurrentPlayerActive()) {
                  $('playersection_'+player_id).scrollIntoView(true);
                  this.updateClickableProgressTrack(player_id, parseInt(args.args.minPosition),parseInt(args.args.maxPosition));
             }
             break;

Re: scrollIntoView in onEnteringState on page refresh

Posted: 11 November 2020, 14:06
by Victoria_La
You have to debug it. Put breakpoint (debugger;) in the code, open dev panel and reload. See if this it is even triggered.

Re: scrollIntoView in onEnteringState on page refresh

Posted: 11 November 2020, 16:34
by Ilmion
I have added console.log before and after the call to scrollIntoView.
I can see in the console my logs of before and after, but the scrollIntoView does not work when I refresh the page.
Does entering in debug could give me something my logs could not have ? And I fear putting a breakpoint could give false information, because while the code is waiting exécution on the breakpoint, the page may have time to finish loading.

Could it be a browser limitation while refreshing ?