From f4d1c353d248ff936c233778929fde9dc6dc0f8a Mon Sep 17 00:00:00 2001 From: Navin Karkera Date: Tue, 11 Oct 2022 18:14:54 +0530 Subject: [PATCH] fix: preview mode navigation previous button (that uses legacy UI) Legacy UI: Previous button should use prev_url if it in first position. In studio UI, it should always use prev_url. To make this possible we checking length of contents which is always zero for studio and more than 0 for legacy UI. (cherry picked from commit cd5544db940ca27aa7cdb0704e42049b1eb375f2) --- common/lib/xmodule/xmodule/js/src/sequence/display.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/js/src/sequence/display.js b/common/lib/xmodule/xmodule/js/src/sequence/display.js index 8c48d29a77bf..f2d23d57ec5d 100644 --- a/common/lib/xmodule/xmodule/js/src/sequence/display.js +++ b/common/lib/xmodule/xmodule/js/src/sequence/display.js @@ -364,7 +364,7 @@ if ((direction === 'next') && (this.position >= this.contents.length)) { targetUrl = this.nextUrl; - } else if ((direction === 'previous')) { + } else if ((direction === 'previous') && (this.position === 1 || this.contents.length === 0)) { targetUrl = this.prevUrl; }