Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(open-knowledge): truncate the Ask AI selection chip label (#2120)

Andrew Mikofalvy95edb4924b23
diff --git a/.changeset/composer-selection-pill-row.md b/.changeset/composer-selection-pill-row.md
index 46c18c3a3..ceed15ad0 100644
--- a/.changeset/composer-selection-pill-row.md
+++ b/.changeset/composer-selection-pill-row.md
@@ -2,4 +2,4 @@
"@inkeep/open-knowledge-app": patch
---
-Ask AI composer: the captured-selection chip now shares one wrapping row with the file-context chips instead of stacking on its own line above them. The chips sit on the same row and only break to a second line when they overflow the available width. The selection chip continues to truncate a long file name so its label no longer spills past the chip's edge, and the expanded selection preview still drops to its own line beneath the chips.
+Ask AI composer: the captured-selection chip now shares one wrapping row with the file-context chips instead of stacking on its own line above them. The chips sit on the same row and only break to a second line when they overflow the available width. The selection chip now truncates a long file name (capped at 16rem) so its label no longer spills past the chip's border, and the expanded selection preview still drops to its own line beneath the chips.
diff --git a/packages/app/src/components/BottomComposer.tsx b/packages/app/src/components/BottomComposer.tsx
index 8fc9824e3..cf390bb94 100644
--- a/packages/app/src/components/BottomComposer.tsx
+++ b/packages/app/src/components/BottomComposer.tsx
@@ -450,8 +450,13 @@ export function BottomComposer({
>
{pinnedSelection ? (
<>
+ {/* `title` recovers the full label once it ellipsis-truncates (mirrors
+ the file chip's `title`). The cap sits a touch wider than the file
+ chip's max-w-[14rem] because selection labels carry a `(range)`
+ suffix. */}
<span
data-testid="composer-selection-pill"
+ title={pinnedLabel}
className="group/chip inline-flex max-w-[16rem] items-center gap-1 rounded-md border bg-muted/40 py-0.5 pr-1.5 pl-1 text-muted-foreground text-xs"
>
{/* The LEADING glyph IS the remove control (mirrors the file chip):
@@ -491,9 +496,9 @@ export function BottomComposer({
}
onClick={() => setSelectionExpanded((open) => !open)}
data-testid="composer-selection-peek"
- className="h-auto min-h-0 min-w-0 justify-start truncate px-0 py-0 text-left font-normal text-muted-foreground text-xs hover:bg-transparent hover:text-foreground"
+ className="h-auto min-h-0 min-w-0 shrink justify-start px-0 py-0 text-left font-normal text-muted-foreground text-xs hover:bg-transparent hover:text-foreground"
>
- {pinnedLabel}
+ <span className="min-w-0 truncate">{pinnedLabel}</span>
</Button>
</span>
{selectionExpanded && pinnedPreview !== '' ? (