Skip to content

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

DEV: Only focus user card first link if not mouse input (#18960)

Keegan George85bfabd84707
diff --git a/app/assets/javascripts/discourse/app/mixins/card-contents-base.js b/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
index 2489a28f7a3..74f173791d6 100644
--- a/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
+++ b/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
@@ -280,10 +280,12 @@ export default Mixin.create({
// note: we DO NOT use afterRender here cause _positionCard may
// run afterwards, if we allowed this to happen the usercard
// may be offscreen and we may scroll all the way to it on focus
- discourseLater(() => {
- const firstLink = this.element.querySelector("a");
- firstLink && firstLink.focus();
- }, 350);
+ if (event.pointerId === -1) {
+ discourseLater(() => {
+ const firstLink = this.element.querySelector("a");
+ firstLink && firstLink.focus();
+ }, 350);
+ }
}
});
},