fix(web): prevent narrow session tooltips (#1114)

This commit is contained in:
Ananovo
2026-07-24 10:57:32 +08:00
committed by GitHub
parent 8c1d5057d7
commit ee5b0239cb
2 changed files with 13 additions and 1 deletions
+12
View File
@@ -9,6 +9,18 @@ import {
afterEach(() => cleanup())
describe('HoverTooltip keyboard wiring', () => {
it('sizes short localized tooltips to their content up to the maximum width', () => {
render(
<HoverTooltip id="attention-tooltip" target={<span>dot</span>}>
</HoverTooltip>
)
const tooltip = screen.getByRole('tooltip', { hidden: true })
expect(tooltip.className).toContain('w-max')
expect(tooltip.className).toContain('max-w-[14rem]')
})
it('applies parent row focus-visible reveal classes', () => {
render(
<HoverTooltip
+1 -1
View File
@@ -72,7 +72,7 @@ export function HoverTooltip(props: {
id={props.id}
className={cn(
'pointer-events-none absolute z-30 whitespace-normal',
spansRow ? 'max-w-none' : 'max-w-[14rem]',
spansRow ? 'max-w-none' : 'w-max max-w-[14rem]',
'rounded-md border border-[var(--app-border)] bg-[var(--app-secondary-bg)]',
'px-2 py-1 text-xs leading-snug text-[var(--app-fg)] shadow-lg',
side === 'top' ? 'bottom-full mb-1' : 'top-full mt-1',