diff --git a/app/assets/javascripts/discourse/views/user-card.js.es6 b/app/assets/javascripts/discourse/views/user-card.js.es6 index bdc35d5438f..08b42013a26 100644 --- a/app/assets/javascripts/discourse/views/user-card.js.es6 +++ b/app/assets/javascripts/discourse/views/user-card.js.es6 @@ -84,18 +84,31 @@ export default Discourse.View.extend(CleansUp, { }, _willShow(target) { + const rtl = ($('html').css('direction')) === 'rtl'; if (!target) { return; } const width = this.$().width(); + Ember.run.schedule('afterRender', () => { if (target) { let position = target.offset(); if (position) { - position.left += target.width() + 10; - const overage = ($(window).width() - 50) - (position.left + width); - if (overage < 0) { - position.left += overage; - position.top += target.height() + 48; + if (rtl) { // The site direction is rtl + position.right = $(window).width() - position.left + 10; + position.left = 'auto'; + let overage = ($(window).width() - 50) - (position.right + width); + if (overage < 0) { + position.right += overage; + position.top += target.height() + 48; + } + } else { // The site direction is ltr + position.left += target.width() + 10; + + let overage = ($(window).width() - 50) - (position.left + width); + if (overage < 0) { + position.left += overage; + position.top += target.height() + 48; + } } position.top -= $('#main-outlet').offset().top;