Skip to content

Commit

Permalink
fix: set focus on target after clicking anchor (#35446)
Browse files Browse the repository at this point in the history
  • Loading branch information
jansenk authored Sep 9, 2024
1 parent e498d20 commit fbd7d4c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lms/templates/courseware/courseware-chromeless.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,12 @@
// to stay in relatively the same position so viewing of the video
// is not disrupted.
if ($(this).attr('class') === 'transcript-start'||$(this).attr('class') === 'transcript-end') {
var target = $(targetId)[0];
event.preventDefault();
$(targetId)[0].scrollIntoView({
target.scrollIntoView({
block: 'nearest',
});
target.focus();
} else {
var targetName = $(this).attr('href').slice(1);
// Checks if the target uses an id or name.
Expand All @@ -159,6 +161,7 @@
target.scrollIntoView({
block: 'start',
});
target.focus();
}
}
}
Expand Down

0 comments on commit fbd7d4c

Please sign in to comment.