Skip to content

Commit 3e1f864

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(studio): activate source popup fixtures through keyboard and focus
1 parent 62c3b6f commit 3e1f864

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎scripts/design-studio/test-fixtures-e2e.mjs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ try {
4141
['tooltip', { state: 'open', export: 'Tooltip.Content' }, '[role=tooltip]'],
4242
['dropdown-menu-sub-content', { action: 'open-submenu' }, '[data-studio-submenu]'],
4343
['popover', { action: 'open-folder' }, '[data-studio-back-button]'],
44+
['chip-dropdown', { state: 'open' }, '[role=menu]'],
45+
['chip-select', { state: 'open' }, '[role=menu]'],
46+
['combobox', { state: 'open', axis: 'editable', value: 'true' }, '[role=listbox]'],
4447
])
4548
for (const theme of ['light', 'dark'])
4649
for (const size of [16, 20]) {

‎tools/design-studio/_components/studio-fixture.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,14 @@ export function StudioFixture({
396396
if (!trigger || activated) return
397397
activated = true
398398
observer.disconnect()
399-
trigger.click()
399+
trigger.focus()
400+
if (trigger.getAttribute('aria-haspopup') === 'menu') {
401+
trigger.dispatchEvent(
402+
new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true, cancelable: true })
403+
)
404+
} else {
405+
trigger.click()
406+
}
400407
}
401408
const observer = new MutationObserver(activate)
402409
observer.observe(document.body, { childList: true, subtree: true })

0 commit comments

Comments
 (0)