Skip to content

A platform for community discussion. Free, open, simple.

FIX: Don't attempt to focus .title in topic-list-item if it doesn't exist (#16274)

Osama Sayegh8dd6cb14eec3
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 806da566fd8..4bdbd7de4bd 100644
--- a/app/assets/javascripts/discourse/app/components/topic-list-item.js
+++ b/app/assets/javascripts/discourse/app/components/topic-list-item.js
@@ -285,7 +285,7 @@ export default Component.extend({
this.element.classList.remove("highlighted");
});
if (opts.isLastViewedTopic && this._shouldFocusLastVisited()) {
- this._titleElement().focus();
+ this._titleElement()?.focus();
}
});
},