Skip to content

Commit 28f8596

Browse files
fix(supersearch): Ensure arrow key handling is reset when clicking expanded input (#1652)
* Ensure arrow key handling is reset when clicking expanded input * Add test --------- Co-authored-by: Jesper Engström <jesper.engstrom@kb.se>
1 parent fff95db commit 28f8596

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

packages/supersearch/e2e/supersearch.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,23 @@ test('supports keyboard navigation between rows and columns/cells', async ({ pag
189189
).toHaveAttribute('aria-activedescendant', 'supersearch-item-2x0');
190190
});
191191

192+
// Ensure https://github.com/libris/lxlviewer/pull/1652 does not regress
193+
test('ensure arrow key handling is reset when clicking expanded input', async ({ page }) => {
194+
await page.getByRole('combobox').click();
195+
await page.getByRole('dialog').getByRole('combobox').fill('abde');
196+
await page.waitForResponse(
197+
(res) => res.url().includes('/api/find?_q=abde') && res.status() === 200
198+
);
199+
await page.keyboard.press('ArrowDown');
200+
await page.keyboard.press('ArrowDown');
201+
await page.keyboard.press('ArrowDown');
202+
await page.getByRole('dialog').getByRole('combobox').click();
203+
await page.keyboard.press('ArrowLeft');
204+
await page.keyboard.press('ArrowLeft');
205+
await page.keyboard.press('c');
206+
await expect(page.getByRole('dialog').getByRole('combobox')).toHaveText('abcde');
207+
});
208+
192209
test('user can toggle expanded search using alt key + arrow up or down (without moving cursor) ', async ({
193210
page
194211
}) => {

packages/supersearch/src/lib/components/SuperSearch.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@
321321
activeColIndex = defaultResultCol;
322322
} else {
323323
activeColIndex = defaultInputCol;
324+
allowArrowKeyCursorHandling = { vertical: false, horizontal: true };
324325
}
325326
}
326327

0 commit comments

Comments
 (0)