A platform for community discussion. Free, open, simple.
A11Y: Focus last viewed topic in topic lists (#15300)
Osama Sayegh76aeee6735ea
diff --git a/app/assets/javascripts/discourse/app/components/topic-list-item.js b/app/assets/javascripts/discourse/app/components/topic-list-item.jsindex 0fcbbd38f1d..f545609487d 100644--- a/app/assets/javascripts/discourse/app/components/topic-list-item.js+++ b/app/assets/javascripts/discourse/app/components/topic-list-item.js@@ -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");+ });});},