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

Follow-up to 97e7bb1ce4

Themes/plugins may override the default `topic-list-item` and remove the `.main-link` or `.title` elements from the template. We shouldn't attempt to focus them if they don't exist.
This commit is contained in:
Osama Sayegh 2022-03-24 08:33:17 +03:00 committed by GitHub
parent 817035b557
commit 8dd6cb14ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -285,7 +285,7 @@ export default Component.extend({
this.element.classList.remove("highlighted");
});
if (opts.isLastViewedTopic && this._shouldFocusLastVisited()) {
this._titleElement().focus();
this._titleElement()?.focus();
}
});
},