mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-27 11:04:39 +00:00
fix(app): restore keyboard project switching in open sidebar (#18682)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { test, expect } from "../fixtures"
|
import { test, expect } from "../fixtures"
|
||||||
import {
|
import {
|
||||||
|
defocus,
|
||||||
cleanupSession,
|
cleanupSession,
|
||||||
cleanupTestProject,
|
cleanupTestProject,
|
||||||
closeSidebar,
|
closeSidebar,
|
||||||
@@ -78,3 +79,40 @@ test("open sidebar project popover stays closed after clicking avatar", async ({
|
|||||||
await cleanupTestProject(other)
|
await cleanupTestProject(other)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("open sidebar project switch activates on first tabbed enter", async ({ page, withProject }) => {
|
||||||
|
await page.setViewportSize({ width: 1400, height: 800 })
|
||||||
|
|
||||||
|
const other = await createTestProject()
|
||||||
|
const slug = dirSlug(other)
|
||||||
|
|
||||||
|
try {
|
||||||
|
await withProject(
|
||||||
|
async () => {
|
||||||
|
await openSidebar(page)
|
||||||
|
await defocus(page)
|
||||||
|
|
||||||
|
const project = page.locator(projectSwitchSelector(slug)).first()
|
||||||
|
|
||||||
|
await expect(project).toBeVisible()
|
||||||
|
|
||||||
|
let hit = false
|
||||||
|
for (let i = 0; i < 20; i++) {
|
||||||
|
hit = await project.evaluate((el) => {
|
||||||
|
return el.matches(":focus") || !!el.parentElement?.matches(":focus")
|
||||||
|
})
|
||||||
|
if (hit) break
|
||||||
|
await page.keyboard.press("Tab")
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(hit).toBe(true)
|
||||||
|
|
||||||
|
await page.keyboard.press("Enter")
|
||||||
|
await waitSession(page, { directory: other })
|
||||||
|
},
|
||||||
|
{ extra: [other] },
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
await cleanupTestProject(other)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export function HoverCard(props: HoverCardProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Kobalte gutter={4} {...rest}>
|
<Kobalte gutter={4} {...rest}>
|
||||||
<Kobalte.Trigger as="div" data-slot="hover-card-trigger">
|
<Kobalte.Trigger as="div" data-slot="hover-card-trigger" tabIndex={-1}>
|
||||||
{local.trigger}
|
{local.trigger}
|
||||||
</Kobalte.Trigger>
|
</Kobalte.Trigger>
|
||||||
<Kobalte.Portal mount={local.mount}>
|
<Kobalte.Portal mount={local.mount}>
|
||||||
|
|||||||
Reference in New Issue
Block a user