From 97519a3ea58cd27f8ce05631882aa84dc1af315a Mon Sep 17 00:00:00 2001 From: Osama Sayegh Date: Tue, 22 Mar 2022 20:09:12 +0300 Subject: [PATCH] Revert "A11Y: Focus last viewed topic in topic lists (#16240)" (#16255) This reverts commit 5d77f485cbcdb7e5f6b1e82c88d06c58f2b5d22e. There are some edge cases that we need to handle better. Reverting this commit because we're going to do a beta release later today. --- .../app/components/topic-list-item.js | 46 +++---------------- .../stylesheets/common/base/_topic-list.scss | 9 ---- 2 files changed, 7 insertions(+), 48 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/topic-list-item.js b/app/assets/javascripts/discourse/app/components/topic-list-item.js index 33c5c37968c..7e3a46dec83 100644 --- a/app/assets/javascripts/discourse/app/components/topic-list-item.js +++ b/app/assets/javascripts/discourse/app/components/topic-list-item.js @@ -1,7 +1,4 @@ -import discourseComputed, { - bind, - observes, -} from "discourse-common/utils/decorators"; +import discourseComputed, { observes } from "discourse-common/utils/decorators"; import Component from "@ember/component"; import DiscourseURL from "discourse/lib/url"; import I18n from "I18n"; @@ -61,11 +58,6 @@ export default Component.extend({ if (this.selected && this.selected.includes(this.topic)) { this.element.querySelector("input.bulk-select").checked = true; } - const title = this.element.querySelector(".main-link .title"); - if (title) { - title.addEventListener("focus", this._onTitleFocus); - title.addEventListener("blur", this._onTitleBlur); - } }); } }, @@ -106,11 +98,6 @@ export default Component.extend({ if (this.includeUnreadIndicator) { this.messageBus.unsubscribe(this.unreadIndicatorChannel); } - const title = this.element?.querySelector(".main-link .title"); - if (title) { - title.removeEventListener("focus", this._onTitleFocus); - title.removeEventListener("blur", this._onTitleBlur); - } }, @discourseComputed("topic.id") @@ -272,15 +259,12 @@ export default Component.extend({ return; } - this.element.classList.add("highlighted"); - this.element.setAttribute( - "data-islastviewedtopic", - opts.isLastViewedTopic - ); - this.element.addEventListener("animationend", () => { - this.element.classList.remove("highlighted"); - }); - this.element.querySelector(".main-link .title").focus(); + const $topic = $(this.element); + $topic + .addClass("highlighted") + .attr("data-islastviewedtopic", opts.isLastViewedTopic); + + $topic.on("animationend", () => $topic.removeClass("highlighted")); }); }, @@ -295,20 +279,4 @@ export default Component.extend({ this.highlight(); } }), - - @bind - _onTitleFocus() { - if (this.element && !this.isDestroying && !this.isDestroyed) { - const mainLink = this.element.querySelector(".main-link"); - mainLink.classList.add("focused"); - } - }, - - @bind - _onTitleBlur() { - if (this.element && !this.isDestroying && !this.isDestroyed) { - const mainLink = this.element.querySelector(".main-link"); - mainLink.classList.remove("focused"); - } - }, }); diff --git a/app/assets/stylesheets/common/base/_topic-list.scss b/app/assets/stylesheets/common/base/_topic-list.scss index 2665b5c8506..ed62a5c7020 100644 --- a/app/assets/stylesheets/common/base/_topic-list.scss +++ b/app/assets/stylesheets/common/base/_topic-list.scss @@ -234,15 +234,6 @@ .raw-topic-link > * { pointer-events: none; } - - &.focused { - box-shadow: inset 3px 0 0 var(--tertiary); - } - /* we have a custom focus indicator so we can remove the native one */ - .title:focus, - .title:focus-visible { - outline: none; - } } .unread-indicator {