@@ -217,7 +217,7 @@ export function updateActiveElement(
217217 | { direction : "forward" | "back" ; initial ?: undefined }
218218 | { direction ?: undefined ; initial : true } ,
219219) : void {
220- requestDebouncedAnimationFrame ( "test-ui.updateActiveElement" , ( ) => {
220+ requestDebouncedAnimationFrame ( "test-ui.updateActiveElement" , async ( ) => {
221221 const { direction, initial } = options ;
222222
223223 let previousActiveWordTop : number | null = null ;
@@ -251,10 +251,6 @@ export function updateActiveElement(
251251
252252 updateWordsInputPosition ( ) ;
253253
254- if ( ! initial && Config . tapeMode !== "off" ) {
255- void scrollTape ( ) ;
256- }
257-
258254 if ( previousActiveWordTop === null ) return ;
259255
260256 const isTimedTest =
@@ -265,9 +261,13 @@ export function updateActiveElement(
265261 if ( isTimedTest || ! Config . showAllLines ) {
266262 const newActiveWordTop = newActiveWord . offsetTop ;
267263 if ( newActiveWordTop > previousActiveWordTop ) {
268- void lineJump ( previousActiveWordTop ) ;
264+ await lineJump ( previousActiveWordTop ) ;
269265 }
270266 }
267+
268+ if ( ! initial && Config . tapeMode !== "off" ) {
269+ await scrollTape ( ) ;
270+ }
271271 } ) ;
272272}
273273
@@ -942,7 +942,7 @@ export async function updateWordLetters({
942942 if ( ! Config . showAllLines ) {
943943 const wordTopAfterUpdate = wordAtIndex . offsetTop ;
944944 if ( wordTopAfterUpdate > activeWordTop ) {
945- void lineJump ( activeWordTop , true ) ;
945+ await lineJump ( activeWordTop , true ) ;
946946 }
947947 }
948948 }
@@ -1210,14 +1210,13 @@ export async function lineJump(
12101210 currentTop : number ,
12111211 force = false ,
12121212) : Promise < void > {
1213- const { resolve, promise } = Misc . promiseWithResolvers ( ) ;
12141213 //last word of the line
12151214 if ( currentTestLine > 0 || force ) {
12161215 const hideBound = currentTop ;
12171216
12181217 const activeWordEl = getActiveWordElement ( ) ;
12191218 if ( ! activeWordEl ) {
1220- resolve ( ) ;
1219+ // resolve();
12211220 return ;
12221221 }
12231222
@@ -1244,10 +1243,9 @@ export async function lineJump(
12441243 }
12451244
12461245 if ( lastElementIndexToRemove === undefined ) {
1247- resolve ( ) ;
12481246 currentTestLine ++ ;
12491247 updateWordsWrapperHeight ( ) ;
1250- return promise ;
1248+ return ;
12511249 }
12521250
12531251 currentLinesJumping ++ ;
@@ -1265,29 +1263,24 @@ export async function lineJump(
12651263
12661264 if ( Config . smoothLineScroll ) {
12671265 lineTransition = true ;
1268- animate ( wordsEl , {
1266+ await Misc . promiseAnimate ( wordsEl , {
12691267 marginTop : newMarginTop ,
12701268 duration,
1271- onComplete : ( ) => {
1272- currentLinesJumping = 0 ;
1273- activeWordTop = activeWordEl . offsetTop ;
1274- activeWordHeight = activeWordEl . offsetHeight ;
1275- removeTestElements ( lastElementIndexToRemove ) ;
1276- wordsEl . style . marginTop = "0" ;
1277- lineTransition = false ;
1278- resolve ( ) ;
1279- } ,
12801269 } ) ;
1270+ currentLinesJumping = 0 ;
1271+ activeWordTop = activeWordEl . offsetTop ;
1272+ activeWordHeight = activeWordEl . offsetHeight ;
1273+ removeTestElements ( lastElementIndexToRemove ) ;
1274+ wordsEl . style . marginTop = "0" ;
1275+ lineTransition = false ;
12811276 } else {
12821277 currentLinesJumping = 0 ;
12831278 removeTestElements ( lastElementIndexToRemove ) ;
1284- resolve ( ) ;
12851279 }
12861280 }
12871281 currentTestLine ++ ;
12881282 updateWordsWrapperHeight ( ) ;
1289-
1290- return promise ;
1283+ return ;
12911284}
12921285
12931286export function setRightToLeft ( isEnabled : boolean ) : void {
0 commit comments