A11Y: Focus last viewed topic in topic lists (#15300)

This commit is contained in:
Osama Sayegh 2021-12-15 02:02:31 +03:00 committed by GitHub
parent 091ca9dbb1
commit 76aeee6735
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -245,12 +245,16 @@ export default Component.extend({
return;
}
const $topic = $(this.element);
$topic
.addClass("highlighted")
.attr("data-islastviewedtopic", opts.isLastViewedTopic);
this.element.classList.add("highlighted");
this.element.setAttribute(
"data-islastviewedtopic",
opts.isLastViewedTopic
);
this.element.querySelector(".main-link .title").focus();
$topic.on("animationend", () => $topic.removeClass("highlighted"));
this.element.addEventListener("animationend", () => {
this.element.classList.remove("highlighted");
});
});
},