Skip to content

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

DEV: Move popups left if application.hbs wrapper is moved by theme

Mark VanLandingham95c871be3eaf
diff --git a/app/assets/javascripts/discourse/app/components/share-popup.js b/app/assets/javascripts/discourse/app/components/share-popup.js
index b62f08dc2c2..8fc21f5aba3 100644
--- a/app/assets/javascripts/discourse/app/components/share-popup.js
+++ b/app/assets/javascripts/discourse/app/components/share-popup.js
@@ -69,7 +69,10 @@ export default Component.extend({
}
const shareLinkWidth = $this.width();
- let x = $currentTargetOffset.left - shareLinkWidth / 2;
+ const pageLeftOffset = document.querySelector(
+ ".ember-application > .ember-view"
+ ).offsetLeft;
+ let x = $currentTargetOffset.left - pageLeftOffset - shareLinkWidth / 2;
if (x < 25) {
x = 25;
}
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 cccf26db7e3..5e07400d0a8 100644
--- a/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
+++ b/app/assets/javascripts/discourse/app/mixins/card-contents-base.js
@@ -201,7 +201,10 @@ export default Mixin.create({
}
} else {
// The site direction is ltr
- position.left += target.width() + 10;
+ const pageLeftOffset = document.querySelector(
+ ".ember-application > .ember-view"
+ ).offsetLeft;
+ position.left += target.width() - pageLeftOffset + 10;
let overage = $(window).width() - 50 - (position.left + width);
if (overage < 0) {