Skip to content
TypeScript

fix(web): stop wide ordered list markers from clipping (#16523)

Utkarsh Patil8c61e254fd07
diff --git a/apps/web/src/components/ChatMarkdown.tsx b/apps/web/src/components/ChatMarkdown.tsx
index 3b736cae265..a56db444d20 100644
--- a/apps/web/src/components/ChatMarkdown.tsx
+++ b/apps/web/src/components/ChatMarkdown.tsx
@@ -378,7 +378,7 @@ function findTaskListMarkerOffset(markdown: string, listItemStart: number): numb
* The default `1.25rem` marker gutter (`.chat-markdown ol`) fits one-character
* markers. Wider markers can extend past it and get clipped by a collapsed
* message's overflow. Widen the gutter to fit the widest marker, including a
- * negative marker's minus sign.
+ * negative marker's minus sign, the period, and the trailing space.
*/
function orderedListGutterStyle(
itemCount: number,
@@ -389,7 +389,7 @@ function orderedListGutterStyle(
const lastNumber = firstNumber + Math.max(itemCount - 1, 0);
const markerWidth = Math.max(String(firstNumber).length, String(lastNumber).length);
if (markerWidth <= 1) return undefined;
- return { "--list-gutter": `${markerWidth + 1}ch` };
+ return { "--list-gutter": `${markerWidth + 2}ch` };
}
type MarkdownImageHastNode = {