Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): preserve RTL reading order in thread search results #48223

OpenDananz(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/48223/headopened View on GitHub

Showing 3 changed files with 87 additions and 17 deletions.

x
0 of 3 viewed, 3 left
1 addition and 0 deletionsapps/web/src/components/sidebar/SidebarThreadRow.tsxModified
View file
@@ -2337,6 +2337,7 @@
? "text-secondary-label/70 group-hover/sidebar-row:text-foreground"
: "text-foreground",
+ dir={textDirection(thread.title)}
{thread.title}
{isRegeneratingTitle ? (
56 additions and 2 deletionsapps/web/src/components/Sidebar.search.browser.test.tsxModified
View file
@@ -7,6 +7,7 @@
import "~/index.css";
​
import { AppRoot } from "~/AppRoot";
+import { SearchMatchHintLine, ThreadSearchMatchExcerpt } from "~/components/ThreadSearchMatch";
import { __setClientSettingsForTests } from "~/hooks/useSettings";
import * as primaryAuth from "~/environments/primary/auth";
import { getRouter } from "~/router";
@@ -30,8 +31,57 @@
return { ...actual, layer: Layer.succeed(actual.ConnectionDriver, fakeDriver) };
});
​
+function wordBounds(container: Element, word: string): DOMRect {
+ const texts = document.createTreeWalker(container, NodeFilter.SHOW_TEXT);
+ for (let node = texts.nextNode(); node; node = texts.nextNode()) {
+ const start = node.textContent?.indexOf(word) ?? -1;
+ if (start < 0) continue;