UniversalDataTool/react-image-annotate

preventDefault is preventing numbers from being typed in the create class menu

aubreyyan opened this issue · 1 comments

useEffect(() => {
const keyMapping = {}
for (let i = 0; i < 9 && i < regionClsList.length; i++) {
keyMapping[i + 1] = () => onSelectCls(regionClsList[i])
}
const onKeyDown = (e) => {
if (keyMapping[e.key]) {
keyMapping[e.key]()
e.preventDefault()
e.stopPropagation()
}
}
window.addEventListener("keydown", onKeyDown)
return () => window.removeEventListener("keydown", onKeyDown)
}, [regionClsList, selectedCls])

This is a breaking change in 1.8.0

I might suggest that there is at least an option to the react component that can disable lines 66-71