Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Safari focus when there are no draggables left #360

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Drag and Drop XBlock changelog
Unreleased
---------------------------

Version 3.2.2 (2023-10-19)
---------------------------

* Fix Safari focus when there are no draggables left.

Version 3.2.1 (2023-10-12)
---------------------------

Expand Down
2 changes: 1 addition & 1 deletion drag_and_drop_v2/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Drag and Drop v2 XBlock """
from .drag_and_drop_v2 import DragAndDropBlock

__version__ = "3.2.1"
__version__ = "3.2.2"
9 changes: 8 additions & 1 deletion drag_and_drop_v2/public/js/drag_and_drop.js
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,14 @@ function DragAndDropBlock(runtime, element, configuration) {
};

var focusFirstDraggable = function() {
$root.find('.item-bank .option').first().focus();
var draggables = $root.find('.item-bank .option[draggable=true]').toArray();
if (draggables.length){
draggables[0].focus();
}
else {
// In case there are no draggable options, we default focus to the first zone.
$root.find('.target .zone').first().focus();
}
};

var focusItemFeedbackPopup = function() {
Expand Down