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

SAK-50757 Gradebook modals launched from cell not receiving focus #13125

Open
wants to merge 2 commits into
base: 23.x
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

<div class="act">
<button wicket:id="submit" type="submit" class="active button_color"><wicket:message key="button.saveoverride" /></button>
<button wicket:id="cancel" type="button"><wicket:message key="button.cancel" /></button>
<button wicket:id="cancel" type="button" class="btn-link"><wicket:message key="button.cancel" /></button>
ottenhoff marked this conversation as resolved.
Show resolved Hide resolved
</div>

</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<body>
<wicket:panel>
<form class="form-vertical" wicket:id="form">
<textarea wicket:id="comment" rows="4" class="form-control form-group"></textarea>
<textarea wicket:id="comment" rows="4" class="form-control form-group my-3"></textarea>
ottenhoff marked this conversation as resolved.
Show resolved Hide resolved
<div class="">
<input type="submit" wicket:id="submit" wicket:message="value:button.savecomment" />
<input type="submit" wicket:id="cancel" wicket:message="value:button.cancel" />
</div>
</form>
</wicket:panel>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<form class="form-vertical" wicket:id="form">
<div wicket:id="editCommentFeedback"></div>

<textarea wicket:id="comment" id="gradeComment" rows="4" class="form-control awesomplete"></textarea>
<textarea wicket:id="comment" id="gradeComment" rows="4" class="form-control awesomplete my-3"></textarea>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this element is missing an accessible name or label. That makes it hard for people using screen readers or voice control to use the control.


<div class="">
<input type="submit" wicket:id="submit" wicket:message="value:button.savecomment" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<div class="act">
<button class="active button_color" wicket:id="submit"><wicket:message key="button.update" /></button>
<button wicket:id="cancel"><wicket:message key="button.cancel"/></button>
<button wicket:id="cancel" class="btn-link"><wicket:message key="button.cancel"/></button>
ottenhoff marked this conversation as resolved.
Show resolved Hide resolved
</div>
</div>

Expand Down
13 changes: 13 additions & 0 deletions gradebookng/tool/src/webapp/scripts/gradebook-gbgrade-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -2764,6 +2764,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;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what exactly is this doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To answer that, I've posted an explainer in the form of a screencast attached to the corresponding jira, titled SAK-50757-ProposedFixExplainer-20250107.mp4.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adrianfish does this fix make sense to you for 23.x? it seems like your fix in SAK-49442 has modified/broken this modal behavior in 23.x


let handled = false;

function iGotThis(allowDefault) {
Expand Down Expand Up @@ -3025,6 +3033,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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,10 @@
.handsontable.ht_master thead {
visibility: hidden;
}
.ht_master tr th .gb-dropdown-menu {
visibility: visible;
}

/* **************************************************************** *
* Gradebook Grade comparison styles *
* **************************************************************** */
Expand Down Expand Up @@ -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;
}
Expand Down
Loading