allow arrow key navigation in the components panel
This commit is contained in:
parent
05ba08a956
commit
d1ae1871c0
|
@ -182,12 +182,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleKeyDown = e => {
|
const handleKeyDown = e => {
|
||||||
if (e.key === "Tab") {
|
if (e.key === "Tab" || e.key === "ArrowDown" || e.key === "ArrowUp") {
|
||||||
// Cycle selected components on tab press
|
// Cycle selected components on tab press
|
||||||
if (selectedIndex == null) {
|
if (selectedIndex == null) {
|
||||||
selectedIndex = 0
|
selectedIndex = 0
|
||||||
} else {
|
} else {
|
||||||
selectedIndex = (selectedIndex + 1) % componentList.length
|
const direction = e.key === "ArrowUp" ? -1 : 1
|
||||||
|
selectedIndex = (selectedIndex + direction) % componentList.length
|
||||||
}
|
}
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
|
|
Loading…
Reference in New Issue