MOBILE-3320 quiz: Fix scroll after clicking Check button
parent
007a7c857e
commit
b2a051723b
|
@ -215,7 +215,6 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
// Reload the current page.
|
// Reload the current page.
|
||||||
const scrollElement = await this.content?.getScrollElement();
|
const scrollElement = await this.content?.getScrollElement();
|
||||||
const scrollTop = scrollElement?.scrollTop || -1;
|
const scrollTop = scrollElement?.scrollTop || -1;
|
||||||
const scrollLeft = scrollElement?.scrollLeft || -1;
|
|
||||||
|
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
this.content?.scrollToTop(); // Scroll top so the spinner is seen.
|
this.content?.scrollToTop(); // Scroll top so the spinner is seen.
|
||||||
|
@ -224,8 +223,11 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
|
||||||
await this.loadPage(this.attempt!.currentpage!);
|
await this.loadPage(this.attempt!.currentpage!);
|
||||||
} finally {
|
} finally {
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
if (scrollTop != -1 && scrollLeft != -1) {
|
if (scrollTop != -1) {
|
||||||
this.content?.scrollToPoint(scrollLeft, scrollTop);
|
// Wait for content to be rendered.
|
||||||
|
setTimeout(() => {
|
||||||
|
this.content?.scrollToPoint(0, scrollTop);
|
||||||
|
}, 50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
Loading…
Reference in New Issue