diff --git a/client/src/components/Chat/Input/Composer/Palette.tsx b/client/src/components/Chat/Input/Composer/Palette.tsx index 5c04528f1d..49e185476b 100644 --- a/client/src/components/Chat/Input/Composer/Palette.tsx +++ b/client/src/components/Chat/Input/Composer/Palette.tsx @@ -55,8 +55,6 @@ const VIEWPORT_PADDING = 12; /** Length of the landing screen's lift transition; see `ChatView`'s * `duration-200` on the same element. */ const LIFT_MS = 200; -/** Ariakit portals to document.body by default, which puts the palette outside every landmark. */ -const getMainLandmark = () => document.querySelector('main'); /** Hidden until the row is hovered or focused, wherever no pointer is coarse. * Any touchscreen keeps them visible, including a 2-in-1's beside its hovering * trackpad. `transition-none` overrides IconButton's color fade so the reveal @@ -1240,9 +1238,11 @@ function Palette({ /> + {/* Keep fixed positioning outside the main container query boundary. + Floating UI treats that boundary as a containing block and subtracts + its offset even in browsers where fixed elements use the viewport. */} { + test('matches the composer bounds beside an expanded sidebar @scenario:palette-matches-composer-bounds', async ({ + page, + }) => { + test.skip((page.viewportSize()?.width ?? 0) < 768, 'Desktop sidebar alignment'); + await gotoMockChat(page); + await useMockEndpoint(page); + const openSidebar = page.getByTestId('open-sidebar-button'); + if (await openSidebar.isVisible()) { + await openSidebar.click(); + } + await expect(page.getByTestId('close-sidebar-button')).toBeVisible(); + await openPalette(page); + + await expect(async () => { + const composerBox = await page.getByTestId('composer-surface').boundingBox(); + const paletteBox = await palette(page).boundingBox(); + expect(composerBox).not.toBeNull(); + expect(paletteBox).not.toBeNull(); + expect(Math.abs(paletteBox!.x - composerBox!.x)).toBeLessThanOrEqual(2); + expect(Math.abs(paletteBox!.width - composerBox!.width)).toBeLessThanOrEqual(2); + }).toPass(); + }); + test('caps long sections with Show all and leaves Tools uncapped @scenario:palette-caps-long-sections-with-show-all', async ({ page, }) => {