mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
fix(sessions): focus picker search after the tab shortcut on touch devices
This commit is contained in:
1 parent
abcecd1c0c
commit
afc95039a8
2 files changed
+31
-1
No files matched your search
@@ -540,6 +540,29 @@ describe('SessionPickerDialog', () => {
|
||||
await waitFor(() => expect(screen.getByPlaceholderText('Search projects...')).toHaveFocus())
|
||||
})
|
||||
|
||||
it('focuses the projects search input after the switch shortcut on a coarse pointer device', async () => {
|
||||
stubMatchMedia(false)
|
||||
mocks.repos = [repo(1, 'alpha', '/w/a'), repo(2, 'beta', '/w/b')]
|
||||
const user = userEvent.setup()
|
||||
renderPicker()
|
||||
|
||||
await user.click(screen.getByPlaceholderText('Search sessions...'))
|
||||
await user.keyboard('{Control>}s{/Control}')
|
||||
|
||||
await waitFor(() => expect(screen.getByPlaceholderText('Search projects...')).toHaveFocus())
|
||||
})
|
||||
|
||||
it('does not focus the projects search input when switching tabs by pointer on a coarse pointer device', async () => {
|
||||
stubMatchMedia(false)
|
||||
mocks.repos = [repo(1, 'alpha', '/w/a'), repo(2, 'beta', '/w/b')]
|
||||
const user = userEvent.setup()
|
||||
renderPicker()
|
||||
|
||||
await user.click(screen.getByRole('tab', { name: 'Projects' }))
|
||||
|
||||
expect(await screen.findByPlaceholderText('Search projects...')).not.toHaveFocus()
|
||||
})
|
||||
|
||||
it('lists repos in the projects tab and opens the cursor repo on Enter', async () => {
|
||||
mocks.repos = [repo(1, 'alpha', '/w/a'), repo(2, 'beta', '/w/b')]
|
||||
const { onSelectRepo } = renderPicker()
|
||||
|
||||
Reference in new issue
Block a user