From c742d420316be22ab2e90cd94b442bed994396d4 Mon Sep 17 00:00:00 2001 From: Simon Cossar Date: Mon, 25 Feb 2019 17:56:52 -0800 Subject: [PATCH] FIX: rtl topic progress wrapper position (#7070) * Set left/right topic-progress-wrapper CSS from text-direction * Remove unnecessary CSS rule --- .../discourse/components/topic-progress.js.es6 | 10 ++++++---- app/assets/stylesheets/common/base/rtl.scss | 5 ----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/discourse/components/topic-progress.js.es6 b/app/assets/javascripts/discourse/components/topic-progress.js.es6 index d77d7f7cbe1..3990124b668 100644 --- a/app/assets/javascripts/discourse/components/topic-progress.js.es6 +++ b/app/assets/javascripts/discourse/components/topic-progress.js.es6 @@ -155,14 +155,16 @@ export default Ember.Component.extend({ const $wrapper = this.$(); if (!$wrapper || $wrapper.length === 0) return; - const offset = window.pageYOffset || $("html").scrollTop(), + const $html = $("html"), + offset = window.pageYOffset || $html.scrollTop(), progressHeight = this.site.mobileView ? 0 : $("#topic-progress").height(), maximumOffset = $("#topic-bottom").offset().top + progressHeight, windowHeight = $(window).height(), bodyHeight = $("body").height(), composerHeight = $("#reply-control").height() || 0, isDocked = offset >= maximumOffset - windowHeight + composerHeight, - bottom = bodyHeight - maximumOffset; + bottom = bodyHeight - maximumOffset, + wrapperDir = $html.hasClass("rtl") ? "left" : "right"; if (composerHeight > 0) { $wrapper.css("bottom", isDocked ? bottom : composerHeight); @@ -174,9 +176,9 @@ export default Ember.Component.extend({ const $replyArea = $("#reply-control .reply-area"); if ($replyArea && $replyArea.length > 0) { - $wrapper.css("right", `${$replyArea.offset().left}px`); + $wrapper.css(wrapperDir, `${$replyArea.offset().left}px`); } else { - $wrapper.css("right", "1em"); + $wrapper.css(wrapperDir, "1em"); } // switch mobile scroll logo at the very bottom of topics diff --git a/app/assets/stylesheets/common/base/rtl.scss b/app/assets/stylesheets/common/base/rtl.scss index e25225d76c3..23e56d0e8ff 100644 --- a/app/assets/stylesheets/common/base/rtl.scss +++ b/app/assets/stylesheets/common/base/rtl.scss @@ -2,11 +2,6 @@ // *** These styles are all going to be flipped by the r2 gem *** // Adding the !important declaration to a rule prevents it from being flipped. -.rtl #topic-progress-wrapper .topic-admin-popup-menu.right-side, -.rtl #topic-progress-wrapper.docked .topic-admin-popup-menu.right-side { - right: 80px; -} - // This is used to flip the .d-icon-caret-right @mixin rotate($degrees) { -webkit-transform: rotate(#{$degrees}deg);