Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-drag-and-drop-v2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
xblock-drag-and-drop-v2
Commits
5c5dc427
Commit
5c5dc427
authored
Mar 22, 2017
by
Albert (AJ) St. Aubin
Committed by
GitHub
Mar 22, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #126 from edx-solutions/aj/TNL-6668_keyboard_help_focus
Aj/tnl 6668 keyboard help focus
parents
7dcf1e6a
cab18591
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
drag_and_drop_v2/public/js/drag_and_drop.js
+15
-14
No files found.
drag_and_drop_v2/public/js/drag_and_drop.js
View file @
5c5dc427
...
@@ -504,7 +504,6 @@ function DragAndDropTemplates(configuration) {
...
@@ -504,7 +504,6 @@ function DragAndDropTemplates(configuration) {
}
}
}
}
var
progress_text
=
progress_template
.
replace
(
'{possible}'
,
formatNumber
(
ctx
.
weighted_max_score
));
var
progress_text
=
progress_template
.
replace
(
'{possible}'
,
formatNumber
(
ctx
.
weighted_max_score
));
return
h
(
'div.problem-progress'
,
{
return
h
(
'div.problem-progress'
,
{
id
:
configuration
.
url_name
+
'-problem-progress'
,
id
:
configuration
.
url_name
+
'-problem-progress'
,
attributes
:
{
role
:
'status'
}
attributes
:
{
role
:
'status'
}
...
@@ -626,7 +625,6 @@ function DragAndDropBlock(runtime, element, configuration) {
...
@@ -626,7 +625,6 @@ function DragAndDropBlock(runtime, element, configuration) {
var
M
=
77
;
var
M
=
77
;
var
$selectedItem
;
var
$selectedItem
;
var
$focusedElement
;
var
init
=
function
()
{
var
init
=
function
()
{
// Load the current user state, and load the image, then render the block.
// Load the current user state, and load the image, then render the block.
...
@@ -706,11 +704,11 @@ function DragAndDropBlock(runtime, element, configuration) {
...
@@ -706,11 +704,11 @@ function DragAndDropBlock(runtime, element, configuration) {
}
}
};
};
var
keyboardEventDispatcher
=
function
(
evt
)
{
var
keyboardEventDispatcher
=
function
(
evt
,
focusId
)
{
if
(
evt
.
which
===
TAB
)
{
if
(
evt
.
which
===
TAB
)
{
trapFocus
(
evt
);
trapFocus
(
evt
);
}
else
if
(
evt
.
which
===
ESC
)
{
}
else
if
(
evt
.
which
===
ESC
)
{
hideKeyboardHelp
(
evt
);
hideKeyboardHelp
(
evt
,
focusId
);
}
}
};
};
...
@@ -788,6 +786,7 @@ function DragAndDropBlock(runtime, element, configuration) {
...
@@ -788,6 +786,7 @@ function DragAndDropBlock(runtime, element, configuration) {
};
};
var
showKeyboardHelp
=
function
(
evt
)
{
var
showKeyboardHelp
=
function
(
evt
)
{
var
focusId
=
document
.
activeElement
;
evt
.
preventDefault
();
evt
.
preventDefault
();
// Show dialog
// Show dialog
...
@@ -795,15 +794,17 @@ function DragAndDropBlock(runtime, element, configuration) {
...
@@ -795,15 +794,17 @@ function DragAndDropBlock(runtime, element, configuration) {
$keyboardHelpDialog
.
find
(
'.modal-window-overlay'
).
show
();
$keyboardHelpDialog
.
find
(
'.modal-window-overlay'
).
show
();
$keyboardHelpDialog
.
find
(
'.modal-window'
).
show
().
focus
();
$keyboardHelpDialog
.
find
(
'.modal-window'
).
show
().
focus
();
// Handle focus
$focusedElement
=
$
(
':focus'
);
// Set up event handlers
// Set up event handlers
$
(
document
).
on
(
'keydown'
,
keyboardEventDispatcher
);
$
(
document
).
on
(
'keydown'
,
function
(
evt
)
{
$keyboardHelpDialog
.
find
(
'.modal-dismiss-button'
).
on
(
'click'
,
hideKeyboardHelp
);
keyboardEventDispatcher
(
evt
,
focusId
);
});
$keyboardHelpDialog
.
find
(
'.modal-dismiss-button'
).
on
(
'click'
,
function
(
evt
)
{
hideKeyboardHelp
(
evt
,
focusId
)
});
};
};
var
hideKeyboardHelp
=
function
(
evt
)
{
var
hideKeyboardHelp
=
function
(
evt
,
focusId
)
{
evt
.
preventDefault
();
evt
.
preventDefault
();
// Hide dialog
// Hide dialog
...
@@ -811,12 +812,12 @@ function DragAndDropBlock(runtime, element, configuration) {
...
@@ -811,12 +812,12 @@ function DragAndDropBlock(runtime, element, configuration) {
$keyboardHelpDialog
.
find
(
'.modal-window-overlay'
).
hide
();
$keyboardHelpDialog
.
find
(
'.modal-window-overlay'
).
hide
();
$keyboardHelpDialog
.
find
(
'.modal-window'
).
hide
();
$keyboardHelpDialog
.
find
(
'.modal-window'
).
hide
();
// Handle focus
$focusedElement
.
focus
();
// Remove event handlers
// Remove event handlers
$
(
document
).
off
(
'keydown'
,
keyboardEventDispatcher
);
$
(
document
).
off
(
'keydown'
);
$keyboardHelpDialog
.
find
(
'.modal-dismiss-button'
).
off
();
$keyboardHelpDialog
.
find
(
'.modal-dismiss-button'
).
off
();
// Handle focus
$
(
focusId
).
focus
();
};
};
/** Asynchronously load the main background image used for this block. */
/** Asynchronously load the main background image used for this block. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment