Repository navigation
feat(web): sidebar thread titles truncate in the middle #29160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1004,6 +1004,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP | |
| isActive: props.isActive, | ||
| }); | ||
|
|
||
| const titleDirection = textDirection(thread.title); | ||
| const title = isRenaming ? ( | ||
| <ThreadRenameInput | ||
| title={renamingTitle} | ||
|
|
@@ -1038,9 +1039,15 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP | |
| ), | ||
| isRegeneratingTitle && "opacity-55", | ||
| )} | ||
| dir={textDirection(thread.title)} | ||
| dir={titleDirection} | ||
| > | ||
| {thread.title} | ||
| {/* The measured cut assumes left-to-right text, so RTL titles keep their end ellipsis. */} | ||
| <MiddleTruncate | ||
| value={thread.title} | ||
| {...(titleDirection === "rtl" ? { tail: 0 } : {})} | ||
| showTitle={false} | ||
| className="flex" | ||
| /> | ||
| </span> | ||
| ); | ||
| const accessibleTitle = isRenaming ? null : <span className="sr-only">{thread.title}</span>; | ||
|
|
@@ -1736,7 +1743,13 @@ export const SidebarSearchResultRow = memo(function SidebarSearchResultRow(props | |
| thread.titleRegeneration != null && "opacity-55", | ||
| )} | ||
| > | ||
| {thread.title} | ||
| <MiddleTruncate | ||
| value={thread.title} | ||
| {...(textDirection(thread.title) === "rtl" ? { tail: 0 } : {})} | ||
|
Comment on lines
+1746
to
+1748
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a narrow sidebar or the search row's PR/time badges leave less space than the selected tail, the title loses both its prefix and the tail's ending. For example, the splitter reserves all 15 characters of Useful? React with 👍 / 👎. |
||
| dir={textDirection(thread.title)} | ||
| showTitle={false} | ||
| className="flex" | ||
| /> | ||
|
Comment on lines
+1746
to
+1752
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| </span> | ||
| <span id={`${props.resultId}-pr`} className="contents"> | ||
| <ThreadSearchPullRequestNumber | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a large expanded sidebar in
slimorfoldermode, this mountsMiddleTruncatein every row, including offscreen rows that rely oncontent-visibility:auto. The helper immediately callsfitHeadin a layout effect, readingscrollWidth,clientWidth, and range bounds; those reads force layout inside the skipped subtrees before paint. These row variants previously rendered titles without measuring them, and the existingleaseLiveStatusvisibility lease does not gate the new measurement. Defer the measured component or its effect until the row is near the viewport so opening a long list does not synchronously lay out every offscreen title.Useful? React with 👍 / 👎.