Skip to content

Commit

Permalink
Disable shortcuts in modals
Browse files Browse the repository at this point in the history
  • Loading branch information
somebody1234 committed Aug 17, 2023
1 parent d11745a commit aad0c2f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,18 @@ export default function ConfirmDeleteModal(props: ConfirmDeleteModalProps) {

return (
<Modal centered className="bg-dim">
<div className="relative rounded-2xl pointer-events-auto">
<div
ref={element => {
element?.focus()
}}
tabIndex={-1}
className="relative rounded-2xl pointer-events-auto"
onKeyDown={event => {
if (event.key !== 'Escape') {
event.stopPropagation()
}
}}
>
<div className="absolute rounded-2xl bg-frame-selected backdrop-blur-3xl w-full h-full" />
<form
onClick={event => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ export default function ManagePermissionsModal(props: ManagePermissionsModalProp
className="absolute overflow-hidden bg-dim w-full h-full top-0 left-0 z-10"
>
<div
ref={element => {
element?.focus()
}}
tabIndex={-1}
style={
position != null
? {
Expand All @@ -248,6 +252,11 @@ export default function ManagePermissionsModal(props: ManagePermissionsModalProp
mouseEvent.stopPropagation()
mouseEvent.preventDefault()
}}
onKeyDown={event => {
if (event.key !== 'Escape') {
event.stopPropagation()
}
}}
>
<div className="absolute bg-frame-selected backdrop-blur-3xl rounded-2xl h-full w-full" />
<div className="relative flex flex-col rounded-2xl gap-2 p-2">
Expand Down

0 comments on commit aad0c2f

Please sign in to comment.