LibreChat/e2e/specs/mock/scenarios/settings-dropdown-escape.spec.ts
Marco Beretta a775ca03f1
Some checks failed
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Vote Gate / Gate (push) Waiting to run
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Has been cancelled
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Has been cancelled
⌨️ fix: Close Only the Dropdown List on Escape Inside Settings (#17503)
* fix: Mark the Escape that closes a Dropdown list as handled

A Headless UI dialog such as Settings closes on any Escape not already
handled, and the Dropdown list closed on Escape without marking it, so
one press closed the list and Settings together. The list now marks the
Escape it handles, so its container stays open until a second press.

* fix: Leave Escape to the container once the Dropdown list is closing

The list closes with a transition and Ariakit keeps it mounted until the
transition ends, so an Escape pressed right after a pick still reached
the list's handler and was marked handled, leaving Settings open.
2026-10-27 19:54:16 +01:00

34 lines
1.3 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { NEW_CHAT_PATH } from '../helpers';
import { openSidebar } from './sidebar';
/**
* Escape walks back one level at a time in the Settings dialog: the first press closes an open
* dropdown list and leaves Settings where it was, the second closes Settings.
*/
test('Escape in a Settings dropdown closes the list before the dialog @scenario:settings-dropdown-escape', async ({
page,
}) => {
await page.goto(NEW_CHAT_PATH, { timeout: 15000 });
/** Mobile keeps the account menu in the drawer. */
await openSidebar(page);
await page.getByTestId('nav-user').filter({ visible: true }).first().click();
await page.getByRole('menuitem', { name: 'Settings' }).click();
const dialog = page.getByRole('dialog');
const clock = dialog.getByRole('combobox', { name: /clock/i }).first();
await dialog.getByRole('tab', { name: /general/i }).click();
await expect(clock).toBeVisible();
await clock.click();
const listbox = page.locator('[role="listbox"]:not([hidden])');
await expect(listbox).toBeVisible();
await page.keyboard.press('Escape');
await expect(listbox).toBeHidden();
await expect(clock).toBeVisible();
await expect(clock).toBeFocused();
await page.keyboard.press('Escape');
await expect(clock).toBeHidden();
});