Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
aubreyyan opened this issue Apr 7, 2022 · 1 comment

Comments

@aubreyyan
Copy link

aubreyyan commented Apr 7, 2022

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

@aubreyyan
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant