From cde80b00a2e14eba4c0704f4786e6b2a9c382343 Mon Sep 17 00:00:00 2001 From: "Horner, Sean A" Date: Thu, 19 Dec 2024 16:33:13 -0800 Subject: [PATCH] SAK-50757 Gradebook: Modals launched from cell not receiving focus --- .../gradebookng/tool/model/GbModalWindow.java | 2 +- .../tool/panels/CourseGradeOverridePanel.html | 2 +- .../tool/panels/EditCourseGradeCommentPanel.html | 4 ++-- .../tool/panels/EditGradeCommentPanel.html | 2 +- .../tool/panels/ZeroUngradedItemsPanel.html | 2 +- .../src/webapp/scripts/gradebook-gbgrade-table.js | 13 +++++++++++++ .../src/sass/modules/tool/gradebook/_gradebook.scss | 8 ++++++++ 7 files changed, 27 insertions(+), 6 deletions(-) diff --git a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/model/GbModalWindow.java b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/model/GbModalWindow.java index 278d6a182a65..28e84fd6b0d8 100644 --- a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/model/GbModalWindow.java +++ b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/model/GbModalWindow.java @@ -69,7 +69,7 @@ protected CharSequence getShowJavaScript() { StringBuilder extraJavascript = new StringBuilder(); // focus the first input field in the content pane - extraJavascript.append(String.format("setTimeout(function() {$('#%s :input:visible:first').focus();});", + extraJavascript.append(String.format("setTimeout(function() {$('#%s :tabbable:visible:first').focus();});", getContent().getMarkupId())); // position at the top of the page diff --git a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/CourseGradeOverridePanel.html b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/CourseGradeOverridePanel.html index 73e663ee3c58..3bdf00ff4107 100644 --- a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/CourseGradeOverridePanel.html +++ b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/CourseGradeOverridePanel.html @@ -38,7 +38,7 @@
- +
diff --git a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/EditCourseGradeCommentPanel.html b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/EditCourseGradeCommentPanel.html index 97b851cb8ad7..6a39c85d76d8 100644 --- a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/EditCourseGradeCommentPanel.html +++ b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/EditCourseGradeCommentPanel.html @@ -3,7 +3,7 @@
- +
@@ -11,4 +11,4 @@ - \ No newline at end of file + diff --git a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/EditGradeCommentPanel.html b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/EditGradeCommentPanel.html index b1859b91fe0f..0683d2d37062 100644 --- a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/EditGradeCommentPanel.html +++ b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/EditGradeCommentPanel.html @@ -7,7 +7,7 @@
- +
diff --git a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/ZeroUngradedItemsPanel.html b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/ZeroUngradedItemsPanel.html index 99c16197e7d7..9eea722af16f 100644 --- a/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/ZeroUngradedItemsPanel.html +++ b/gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/ZeroUngradedItemsPanel.html @@ -12,7 +12,7 @@
- +
diff --git a/gradebookng/tool/src/webapp/scripts/gradebook-gbgrade-table.js b/gradebookng/tool/src/webapp/scripts/gradebook-gbgrade-table.js index d92beec19cef..27a22e54a21c 100644 --- a/gradebookng/tool/src/webapp/scripts/gradebook-gbgrade-table.js +++ b/gradebookng/tool/src/webapp/scripts/gradebook-gbgrade-table.js @@ -2756,6 +2756,14 @@ GbGradeTable.setupKeyboardNavigation = function() { }); GbGradeTable.instance.addHook("beforeKeyDown", function(event) { + // If the wicket modal is displaying, prevent event propagation and return + if (document.getElementsByClassName('wicket-modal').length > 0) { + // The next line prevents behaviors such as keystroking tab that navigates to other handsontable cells + // instead of navigating to the next tabbable control in the modal. + event.stopImmediatePropagation(); + return; + } + let handled = false; function iGotThis(allowDefault) { @@ -3017,6 +3025,11 @@ GbGradeTable.setupCellMetaDataSummary = function() { }); GbGradeTable.instance.addHook("beforeKeyDown", function(event) { + // If the wicket modal is displaying, bypass the remainder of this hook + if (document.getElementsByClassName('wicket-modal').length > 0) { + return; + } + // get the last and visible, as may be multiple due to fixed columns var $current = $(GbGradeTable.instance.rootElement).find("td.current:visible:last"); diff --git a/library/src/skins/default/src/sass/modules/tool/gradebook/_gradebook.scss b/library/src/skins/default/src/sass/modules/tool/gradebook/_gradebook.scss index 49dd42582ccc..757677a938ae 100644 --- a/library/src/skins/default/src/sass/modules/tool/gradebook/_gradebook.scss +++ b/library/src/skins/default/src/sass/modules/tool/gradebook/_gradebook.scss @@ -627,6 +627,10 @@ .handsontable.ht_master thead { visibility: hidden; } + .ht_master tr th .gb-dropdown-menu { + visibility: visible; + } + /* **************************************************************** * * Gradebook Grade comparison styles * * **************************************************************** */ @@ -1592,6 +1596,10 @@ div.wicket-modal { position: absolute; } +div.wicket-modal .awesomplete { + width: 100%; +} + div.wicket-mask-transparent, div.wicket-mask-dark { z-index: 998 !important; }