diff --git a/lms/envs/common.py b/lms/envs/common.py index 7c005ce6ad..87399a56f8 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1278,6 +1278,7 @@ base_application_js = [ 'js/src/utility.js', 'js/src/logger.js', 'js/my_courses_dropdown.js', + 'js/dialog_tab_controls.js', 'js/src/string_utils.js', 'js/form.ext.js', 'js/src/ie_shim.js', diff --git a/lms/static/js/dialog_tab_controls.js b/lms/static/js/dialog_tab_controls.js new file mode 100644 index 0000000000..e46bac80cd --- /dev/null +++ b/lms/static/js/dialog_tab_controls.js @@ -0,0 +1,67 @@ +var DialogTabControls = (function() { + 'use strict'; + + var focusableChildren, + numElements, + currentIndex, + initializeTabKeyValues = function(elementName, $closeButton) { + focusableChildren = $(elementName).find( + 'a, input[type=text], input[type=submit], select, textarea, button' + ); + if ($closeButton) { + focusableChildren = focusableChildren.add($closeButton); + } + numElements = focusableChildren.length; + currentIndex = 0; + focusableChildren[currentIndex].focus(); + }, + focusElement = function() { + var focusableElement = focusableChildren[currentIndex]; + if (focusableElement) { + focusableElement.focus(); + } + }, + focusPrevious = function() { + currentIndex--; + if (currentIndex < 0) { + currentIndex = numElements - 1; + } + + focusElement(); + + return false; + }, + focusNext = function() { + currentIndex++; + if (currentIndex >= numElements) { + currentIndex = 0; + } + + focusElement(); + + return false; + }, + setKeydownListner = function($modal, $closeButton) { + $modal.on('keydown', function(e) { + var keyCode = e.keyCode || e.which, + escapeKeyCode = 27, + tabKeyCode = 9; + if (keyCode === escapeKeyCode) { + e.preventDefault(); + $closeButton.click(); + } + if (keyCode === tabKeyCode && e.shiftKey) { + e.preventDefault(); + focusPrevious(); + } else if (keyCode === tabKeyCode) { + e.preventDefault(); + focusNext(); + } + }); + }; + + return { + initializeTabKeyValues: initializeTabKeyValues, + setKeydownListner: setKeydownListner + }; +}()); diff --git a/lms/static/sass/course/courseware/_courseware.scss b/lms/static/sass/course/courseware/_courseware.scss index 73af1edb3b..9e503c21eb 100644 --- a/lms/static/sass/course/courseware/_courseware.scss +++ b/lms/static/sass/course/courseware/_courseware.scss @@ -557,6 +557,14 @@ html.video-fullscreen { } } + section.xqa-modal, section.staff-modal, section.history-modal { + width: 80%; + height: 80%; + left: left(20%); + overflow: auto; + display: none; + } + div.staff_info { display: none; @include clearfix(); diff --git a/lms/templates/courseware/xqa_interface.html b/lms/templates/courseware/xqa_interface.html index 6fc5d8db15..eb550cbfc7 100644 --- a/lms/templates/courseware/xqa_interface.html +++ b/lms/templates/courseware/xqa_interface.html @@ -5,11 +5,19 @@ %endif diff --git a/lms/templates/staff_problem_info.html b/lms/templates/staff_problem_info.html index 8038a15e2d..82d4cb1b0c 100644 --- a/lms/templates/staff_problem_info.html +++ b/lms/templates/staff_problem_info.html @@ -31,7 +31,7 @@ ${block_content} % endif -