mirror of
https://github.com/vercel/commerce.git
synced 2025-06-18 13:11:23 +00:00
A nice focus trap :D
This commit is contained in:
parent
4f3ce796d1
commit
885a7ccdc1
@ -16,12 +16,10 @@ interface Props {
|
||||
onEnter?: () => void | null
|
||||
}
|
||||
|
||||
// Todo: Drag focus to component
|
||||
|
||||
const Modal: FC<Props> = ({ children, open, onClose, onEnter = null }) => {
|
||||
const ref = useRef() as React.MutableRefObject<HTMLDivElement>
|
||||
|
||||
const handleKey = (e: KeyboardEvent<HTMLDivElement>) => {
|
||||
const handleKey = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Escape') {
|
||||
return onClose()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user