1
0
Fork 0
mirror of synced 2024-08-15 10:01:34 +12:00

allow arrow key navigation in the components panel

This commit is contained in:
Martin McKeaveney 2023-03-24 16:32:41 +00:00
parent 05ba08a956
commit d1ae1871c0

View file

@ -182,12 +182,13 @@
}
const handleKeyDown = e => {
if (e.key === "Tab") {
if (e.key === "Tab" || e.key === "ArrowDown" || e.key === "ArrowUp") {
// Cycle selected components on tab press
if (selectedIndex == null) {
selectedIndex = 0
} else {
selectedIndex = (selectedIndex + 1) % componentList.length
const direction = e.key === "ArrowUp" ? -1 : 1
selectedIndex = (selectedIndex + direction) % componentList.length
}
e.preventDefault()
e.stopPropagation()