Skip to content

Commit 90c44f3

Browse files
authored
fix: scroll to top inside iframe
On clicking continue button in editor, scroll to top was not working inside iframes. This commit checks if the editor is displayed inside an iframe like in library authoring or new mfe course authoring and scrolls based on it.
1 parent 9d81083 commit 90c44f3

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Drag and Drop XBlock changelog
44
Unreleased
55
---------------------------
66

7+
Version 5.0.1 (2025-02-19)
8+
---------------------------
9+
10+
* Scroll to the top of the editor in iframes (in the authoring MFE).
11+
712
Version 5.0.0 (2025-02-19)
813
---------------------------
914

drag_and_drop_v2/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
""" Drag and Drop v2 XBlock """
22
from .drag_and_drop_v2 import DragAndDropBlock
33

4-
__version__ = "5.0.0"
4+
__version__ = "5.0.1"

drag_and_drop_v2/public/js/drag_and_drop_edit.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ function DragAndDropEditBlock(runtime, element, params) {
175175
},
176176

177177
scrollToTop: function() {
178-
$('.drag-builder', element).scrollTop(0);
178+
if (self !== top) {
179+
$("html,body").scrollTop(0);
180+
} else {
181+
$('.drag-builder', element).scrollTop(0);
182+
}
179183
},
180184

181185
clickHandlers: function() {

0 commit comments

Comments
 (0)