scrollIntoView in onEnteringState on page refresh

Game development with Board Game Arena Studio
Post Reply
User avatar
Ilmion
Posts: 30
Joined: 28 March 2020, 03:26

scrollIntoView in onEnteringState on page refresh

Post 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;
User avatar
Victoria_La
Posts: 665
Joined: 28 December 2015, 20:55

Re: scrollIntoView in onEnteringState on page refresh

Post 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.
User avatar
Ilmion
Posts: 30
Joined: 28 March 2020, 03:26

Re: scrollIntoView in onEnteringState on page refresh

Post 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 ?
Post Reply

Return to “Developers”