Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): cut chat names by their own direction

Yudhi Armyndharis0a6eaa4c932d
diff --git a/dashboard/src/bidi.test.ts b/dashboard/src/bidi.test.ts
index a5fb3f87e..3774115e3 100644
--- a/dashboard/src/bidi.test.ts
+++ b/dashboard/src/bidi.test.ts
@@ -31,3 +31,23 @@ test('the header lines hug the start edge with the name instead of stretching ac
assert.match(body('pages/Chats.css', selector), /align-self:\s*flex-start/, selector);
}
});
+
+test('text cut with an ellipsis takes its direction from its own characters', () => {
+ // The ellipsis removes the end of the line in the direction of the box. Under the page direction a Latin name in
+ // an Arabic page (or an Arabic one in an English page) lost its first letters and kept its last.
+ const cut = [
+ '.chats-page .chat-item-name',
+ '.chats-page .chat-item-snippet',
+ '.chats-page .room-contact-info h3',
+ '.chats-page .preview-filename',
+ '.chats-page .quote-body',
+ '.chats-page .replying-to-title',
+ '.chats-page .replying-to-body',
+ '.chats-page .group-info-member .name',
+ ];
+ for (const selector of cut) {
+ const rule = body('pages/Chats.css', selector);
+ assert.match(rule, /text-overflow:\s*ellipsis/, `${selector} is expected to be cut with an ellipsis`);
+ assert.match(rule, /unicode-bidi:\s*plaintext/, selector);
+ }
+});
diff --git a/dashboard/src/pages/Chats.css b/dashboard/src/pages/Chats.css
index 6d2bf1111..778184f8b 100644
--- a/dashboard/src/pages/Chats.css
+++ b/dashboard/src/pages/Chats.css
@@ -238,6 +238,9 @@
gap: 6px;
}
+/* Text that is cut with an ellipsis takes its direction from its own characters (unicode-bidi: plaintext).
+ Under an inherited direction the ellipsis eats the wrong end of a name written the other way round: a
+ Latin name in an Arabic page lost its first letters and kept its last ("...hi Armyndharis"). */
.chats-page .chat-item-name {
font-size: 0.9375rem;
font-weight: 600;
@@ -245,6 +248,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
}
.chats-page .chat-item-time {
@@ -266,6 +270,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
max-width: 180px;
}
@@ -423,6 +428,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
}
/* Prettified phone (or "Group" / "Private contact" label for non-personal JIDs). Primary subtitle
@@ -993,6 +999,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
}
.chats-page .preview-filesize {
@@ -1467,6 +1474,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
max-width: 250px;
}
@@ -1576,6 +1584,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
}
.chats-page .replying-to-body {
@@ -1584,6 +1593,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
}
.chats-page .btn-close-reply {
@@ -2606,6 +2616,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+ unicode-bidi: plaintext;
}
.chats-page .group-info-member .number {