From 85bfabd847076c135d8def2a0325f06f0f11d0cf Mon Sep 17 00:00:00 2001 From: Keegan George Date: Thu, 10 Nov 2022 10:12:03 -0800 Subject: [PATCH] DEV: Only focus user card first link if not mouse input (#18960) --- .../discourse/app/mixins/card-contents-base.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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); + } } }); },