From fbd7d4ca4c10f755974a8b0a524f503dca5aee2c Mon Sep 17 00:00:00 2001 From: Jansen Kantor Date: Mon, 9 Sep 2024 12:00:07 -0400 Subject: [PATCH] fix: set focus on target after clicking anchor (#35446) --- lms/templates/courseware/courseware-chromeless.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lms/templates/courseware/courseware-chromeless.html b/lms/templates/courseware/courseware-chromeless.html index e8411c9e42..deeda26c43 100644 --- a/lms/templates/courseware/courseware-chromeless.html +++ b/lms/templates/courseware/courseware-chromeless.html @@ -144,10 +144,12 @@ ${HTML(fragment.foot_html())} // 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. @@ -159,6 +161,7 @@ ${HTML(fragment.foot_html())} target.scrollIntoView({ block: 'start', }); + target.focus(); } } }