LIT-EIA / adapt-esdc-accessibilityfixes

Extension to load and run a .js file when a course loads
GNU General Public License v3.0
5 stars 2 forks source link

All - slowdowns #169

Closed LIT-EIA-OWNER closed 2 years ago

LIT-EIA-OWNER commented 2 years ago

When a page is really big / contains a lot of interactions, there is a lag time when closing the popup.

Happens even when accessibility fixes is off so it's in the core of Adapt.

falcochip commented 2 years ago

this code was to change focus on error - prolly for WSCOE comment out the following //Only trigger if instructions exist and not empty if (instrfocus.length > 0 && !(instrfocus.html() == "")) { $([document.documentElement, document.body]).animate({ scrollTop: instrfocus.offset().top - (window.innerHeight / 2) }, 200); }

ftourangeau commented 1 year ago

Dug deeper into the source of the problem and found that the event listener for the submit button (that contained the scrolling code) was declared every time a popup was opened. I added linkfixes() and altfixes() execution in popupfixes() and removed execution of globalfixes() in popupfixes() to prevent the declaration from rerunning when popup is opened. It was then possible to uncomment the scrolling (accessibility requirement). I also added a verification that no answer was selected so it doesn't scroll when there is no error (scroll behind popup)