Skip to content

Commit 65e11c7

Browse files
authored
Merge pull request openwebwork#3096 from Alex-Jordan/button-space
make a few anchors with 'role="button"' respond to space
2 parents f3c816b + f578302 commit 65e11c7

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

htdocs/js/System/system.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@
9393
});
9494
}
9595

96+
// Make elements with role="button" (that have been given the class below) activate upon use of the spacebar.
97+
for (const btn of document.querySelectorAll('.spacebar-activatable')) {
98+
btn.addEventListener('keydown', (e) => {
99+
if (e.key === ' ') {
100+
e.preventDefault();
101+
btn.click();
102+
}
103+
});
104+
}
105+
96106
// Turn help boxes into popovers
97107
document.querySelectorAll('.help-popup').forEach((popover) => {
98108
popover.addEventListener('click', (e) => e.preventDefault());

templates/ContentGenerator/CourseAdmin/manage_lti_course_map_form.html.ep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</td>
3131
<td class="text-center">
3232
% if ($ltiConfigs->{$_}{LTIVersion} && $ltiConfigs->{$_}{LTIVersion} =~ /^v1p[13]$/) {
33-
<a href="#" role="button" data-bs-toggle="modal"
33+
<a href="#" role="button" class="lti-config-btn spacebar-activatable" data-bs-toggle="modal"
3434
data-bs-target="#<%= $_ %>-config-modal">
3535
<i class="fa-solid fa-circle-question fa-xl"></i>
3636
<span class="visually-hidden"><%= maketext('LTI Configuration') %></span>

templates/ContentGenerator/Instructor/JobManager.html.ep

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@
183183
<div class="d-flex justify-content-between gap-1">
184184
<%= maketext($jobs->{$jobID}{state}) =%>
185185
% if (defined $jobs->{$jobID}{result}) {
186-
<a role="button" class="result-btn" tabindex="0" data-bs-toggle="modal" href="#"
187-
data-bs-target="<%= "#result-$jobID" %>">
186+
<a role="button" class="result-btn spacebar-activatable" data-bs-toggle="modal"
187+
href="#" data-bs-target="<%= "#result-$jobID" %>">
188188
<i class="fa-solid fa-circle-info fa-xl" aria-hidden="true"></i>
189189
<span class="visually-hidden">
190190
<%= maketext('Result for job [_1]', $jobID) %>

0 commit comments

Comments
 (0)