From fdadd4cdf4d45f996f225507ea42732ecd42e007 Mon Sep 17 00:00:00 2001 From: Anthony Mangano Date: Mon, 18 Dec 2017 14:05:21 -0500 Subject: [PATCH] Fix a11y issues with unenroll modal --- lms/static/js/dashboard/legacy.js | 1 - .../views/entitlement_unenrollment_view.js | 6 +----- lms/static/js/toggle_login_modal.js | 8 -------- lms/templates/dashboard.html | 10 +++++++--- themes/edx.org/lms/templates/dashboard.html | 10 +++++++--- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/lms/static/js/dashboard/legacy.js b/lms/static/js/dashboard/legacy.js index 0b48918d23..be8df1fc54 100644 --- a/lms/static/js/dashboard/legacy.js +++ b/lms/static/js/dashboard/legacy.js @@ -188,7 +188,6 @@ $('#unenroll_form input[type="submit"]').prop('disabled', true); }); - edx.dashboard.dropdown.toggleCourseActionsDropdownMenu(event); $('#unenroll-modal').css('position', 'fixed'); }); diff --git a/lms/static/js/learner_dashboard/views/entitlement_unenrollment_view.js b/lms/static/js/learner_dashboard/views/entitlement_unenrollment_view.js index 00387be204..840dc09f1c 100644 --- a/lms/static/js/learner_dashboard/views/entitlement_unenrollment_view.js +++ b/lms/static/js/learner_dashboard/views/entitlement_unenrollment_view.js @@ -52,11 +52,7 @@ this.resetModal(); this.setHeaderText(courseName, courseNumber); this.setSubmitData(apiEndpoint); - - if (window.edx && window.edx.dashboard && window.edx.dashboard.dropdown) { - window.edx.dashboard.dropdown.toggleCourseActionsDropdownMenu(event); - this.$el.css('position', 'fixed'); - } + this.$el.css('position', 'fixed'); }, handleSubmit: function() { diff --git a/lms/static/js/toggle_login_modal.js b/lms/static/js/toggle_login_modal.js index bb38c52639..4c2f9a424e 100644 --- a/lms/static/js/toggle_login_modal.js +++ b/lms/static/js/toggle_login_modal.js @@ -86,14 +86,6 @@ $(modal_id).show().fadeTo(200, 1); $(modal_id).find('.notice').hide().html(''); - var notice = $(this).data('notice'); - if (notice !== undefined) { - $notice = $(modal_id).find('.notice'); - $notice.show().html(notice); - // This is for activating leanModal links that were in the notice. We should have a cleaner way of - // allowing all dynamically added leanmodal links to work. - $notice.find('a[rel*=leanModal]').leanModal({top: 120, overlay: 1, closeButton: '.close-modal', position: 'absolute'}); - } window.scrollTo(0, 0); e.preventDefault(); }); diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index a9d179f5e8..8278b67b23 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -61,9 +61,13 @@ from student.models import CourseEnrollment }); <%static:require_module module_name="js/learner_dashboard/entitlement_unenrollment_factory" class_name="EntitlementUnenrollmentFactory"> - EntitlementUnenrollmentFactory({ - dashboardPath: "${reverse('dashboard') | n, js_escaped_string}", - signInPath: "${reverse('signin_user') | n, js_escaped_string}" + ## Wait until the document is fully loaded before initializing the EntitlementUnenrollmentView + ## to ensure events are setup correctly. + $(document).ready(function() { + EntitlementUnenrollmentFactory({ + dashboardPath: "${reverse('dashboard') | n, js_escaped_string}", + signInPath: "${reverse('signin_user') | n, js_escaped_string}" + }); }); % if settings.FEATURES.get('ENABLE_DASHBOARD_SEARCH'): diff --git a/themes/edx.org/lms/templates/dashboard.html b/themes/edx.org/lms/templates/dashboard.html index b93f1d0b3f..9be741c45e 100644 --- a/themes/edx.org/lms/templates/dashboard.html +++ b/themes/edx.org/lms/templates/dashboard.html @@ -63,9 +63,13 @@ from student.models import CourseEnrollment }); <%static:require_module module_name="js/learner_dashboard/entitlement_unenrollment_factory" class_name="EntitlementUnenrollmentFactory"> - EntitlementUnenrollmentFactory({ - dashboardPath: "${reverse('dashboard') | n, js_escaped_string}", - signInPath: "${reverse('signin_user') | n, js_escaped_string}" + ## Wait until the document is fully loaded before initializing the EntitlementUnenrollmentView + ## to ensure events are setup correctly. + $(document).ready(function() { + EntitlementUnenrollmentFactory({ + dashboardPath: "${reverse('dashboard') | n, js_escaped_string}", + signInPath: "${reverse('signin_user') | n, js_escaped_string}" + }); }); % if settings.FEATURES.get('ENABLE_DASHBOARD_SEARCH'):