Skip to content

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

FIX: correct @ symbol placement in mentions for RTL locales (#37723)

Régis Hanol42d10619d398
diff --git a/app/assets/stylesheets/common/foundation/mixins.scss b/app/assets/stylesheets/common/foundation/mixins.scss
index 6cb6373f36d..d4ea9a71c19 100644
--- a/app/assets/stylesheets/common/foundation/mixins.scss
+++ b/app/assets/stylesheets/common/foundation/mixins.scss
@@ -257,6 +257,7 @@ $hpad: 0.65em;
text-decoration: none;
text-wrap: nowrap;
line-height: 1;
+ unicode-bidi: plaintext;
&[data-valid="false"] {
background: unset;
diff --git a/frontend/discourse/tests/acceptance/post-inline-mentions-test.js b/frontend/discourse/tests/acceptance/post-inline-mentions-test.js
index 0ce58143c4d..cc052a9038c 100644
--- a/frontend/discourse/tests/acceptance/post-inline-mentions-test.js
+++ b/frontend/discourse/tests/acceptance/post-inline-mentions-test.js
@@ -200,6 +200,29 @@ acceptance(`Post inline mentions – user status tooltip`, function (needs) {
});
});
+acceptance(`Post inline mentions – text direction`, function (needs) {
+ needs.user();
+
+ const topicId = 130;
+ const mentionedUserId = 1;
+
+ test("mentions have unicode-bidi plaintext for correct RTL rendering", async function (assert) {
+ pretender.get(`/t/${topicId}.json`, () => {
+ return response(topicWithoutUserStatus(topicId, mentionedUserId));
+ });
+
+ await visit(`/t/lorem-ipsum-dolor-sit-amet/${topicId}`);
+
+ const mention = document.querySelector(".topic-post .cooked .mention");
+ const style = getComputedStyle(mention);
+ assert.strictEqual(
+ style.unicodeBidi,
+ "plaintext",
+ "@ symbol renders correctly in RTL contexts"
+ );
+ });
+});
+
acceptance(`Post inline mentions as an anonymous user`, function (needs) {
needs.settings({
enable_user_status: true,