Skip to content

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

FIX: optimizes sk body position in RTL mode (#10997)

Joffrey JAFFEUX281bf0b3454d
diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit.js b/app/assets/javascripts/select-kit/addon/components/select-kit.js
index a89055b5894..439a71b1c33 100644
--- a/app/assets/javascripts/select-kit/addon/components/select-kit.js
+++ b/app/assets/javascripts/select-kit/addon/components/select-kit.js
@@ -32,6 +32,12 @@ const SELECT_KIT_OPTIONS = Mixin.create({
selectKitOptions: EMPTY_OBJECT,
});
+function isDocumentRTL() {
+ return (
+ window.getComputedStyle(document.querySelector("html")).direction === "rtl"
+ );
+}
+
export default Component.extend(
SELECT_KIT_OPTIONS,
PluginApiMixin,
@@ -268,7 +274,7 @@ export default Component.extend(
clearOnClick: false,
closeOnChange: true,
limitMatches: null,
- placement: "bottom-start",
+ placement: isDocumentRTL() ? "bottom-end" : "bottom-start",
placementStrategy: null,
filterComponent: "select-kit/select-kit-filter",
selectedNameComponent: "selected-name",
diff --git a/app/assets/javascripts/select-kit/addon/components/topic-notifications-button.js b/app/assets/javascripts/select-kit/addon/components/topic-notifications-button.js
index ecbc74bc6b6..dd7ada4144c 100644
--- a/app/assets/javascripts/select-kit/addon/components/topic-notifications-button.js
+++ b/app/assets/javascripts/select-kit/addon/components/topic-notifications-button.js
@@ -8,7 +8,6 @@ export default Component.extend({
classNameBindings: ["isLoading"],
appendReason: true,
showFullTitle: true,
- placement: "bottom-start",
notificationLevel: null,
topic: null,
showCaret: true,
diff --git a/app/assets/javascripts/select-kit/addon/templates/components/topic-notifications-button.hbs b/app/assets/javascripts/select-kit/addon/templates/components/topic-notifications-button.hbs
index f21111ebbd5..c64cf9dbf26 100644
--- a/app/assets/javascripts/select-kit/addon/templates/components/topic-notifications-button.hbs
+++ b/app/assets/javascripts/select-kit/addon/templates/components/topic-notifications-button.hbs
@@ -7,7 +7,6 @@
options=(hash
icon=icon
showFullTitle=showFullTitle
- placement=placement
preventsClickPropagation=true
showCaret=showCaret
)
@@ -22,7 +21,6 @@
options=(hash
icon=icon
showFullTitle=showFullTitle
- placement=placement
preventsClickPropagation=true
showCaret=showCaret
)