fix(web): align pending session indicators (#2425)

* fix(web): align pending session indicators

* fix(web): preserve background tooltip placement
This commit is contained in:
Ananovo
2026-11-13 12:09:04 +08:00
committed by GitHub
parent bebda45006
commit 6ea40f9e44
6 changed files with 38 additions and 2 deletions
+1
View File
@@ -57,6 +57,7 @@ export function HoverTooltip(props: {
return (
<span
ref={props.containerRef}
data-hover-tooltip-anchor=""
className={cn(
spansRow ? 'static' : 'relative',
'inline-flex group',
@@ -42,6 +42,31 @@ function makeRequest(overrides: Partial<PendingRequest> & { id: string; kind: Pe
}
describe('SessionAttentionIndicator tooltip', () => {
it('keeps background tooltips left-anchored while pending tooltips stay inside the right edge', () => {
const pending = renderWithI18n(
<SessionAttentionIndicator
attention={{ kind: 'input' }}
summary={makeSummary({ id: 'pending' })}
label="Awaiting your answer"
tooltipId="pending-alignment"
/>
)
expect(screen.getByRole('tooltip', { hidden: true })).toHaveClass('right-0')
expect(screen.getByRole('tooltip', { hidden: true })).not.toHaveClass('left-0')
pending.unmount()
renderWithI18n(
<SessionAttentionIndicator
attention={{ kind: 'background' }}
summary={makeSummary({ id: 'background', backgroundTaskCount: 1 })}
label="Background tasks running"
tooltipId="background-alignment"
/>
)
expect(screen.getByRole('tooltip', { hidden: true })).toHaveClass('left-0')
expect(screen.getByRole('tooltip', { hidden: true })).not.toHaveClass('right-0')
})
it('renders permission tooltip body listing each pending tool', () => {
const summary = makeSummary({
id: 's1',
@@ -61,7 +61,7 @@ export function SessionAttentionIndicator(props: {
id={props.tooltipId}
target={dot}
side="bottom"
align="start"
align={kind === 'background' ? 'start' : 'end'}
className="shrink-0"
revealOnParentFocusClass={SESSION_ROW_TOOLTIP_FOCUS_CLASS}
>
@@ -580,6 +580,7 @@ describe('SessionRowSummary time label', () => {
</I18nProvider>
)
expect(screen.getByText('just now')).toBeInTheDocument()
expect(screen.getByText('just now')).toHaveClass('translate-y-[0.5px]')
act(() => { vi.advanceTimersByTime(2 * 60_000) })
expect(screen.getByText('2m ago')).toBeInTheDocument()
+1 -1
View File
@@ -325,7 +325,7 @@ export function SessionRowSummary(props: {
</span>
) : null}
{timeLabel ? (
<span className={`min-w-0 truncate whitespace-nowrap tabular-nums ${
<span className={`min-w-0 translate-y-[0.5px] truncate whitespace-nowrap tabular-nums ${
emphasizeUnread ? 'font-semibold text-[var(--app-link)]' : 'text-[var(--app-hint)]'
}`}>{timeLabel}</span>
) : null}
+9
View File
@@ -519,6 +519,15 @@ html:has(.chat-scroll-y) #root {
opacity: 1;
}
/* Hover tooltips are absolutely positioned inside a row, but the collapsible
* shell must keep overflow hidden during its height animation. Once a row
* tooltip is active, let that shell expose it so the tooltip's lower edge is
* not clipped by the group boundary. */
.collapsible-panel[data-open] > .collapsible-inner:has([data-hover-tooltip-anchor]:hover),
.collapsible-panel[data-open] > .collapsible-inner:has(.session-list-item:focus-visible) {
overflow: visible;
}
/* Scale content area to use available space on wide screens */
@media (min-width: 1280px) {
:root {