Skip to content

Commit

Permalink
chore: delay the activation of keybindings on modal close
Browse files Browse the repository at this point in the history
  • Loading branch information
anwarulislam committed Mar 29, 2024
1 parent 6308901 commit 5bbdc58
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/hoppscotch-common/src/modules/ui.ts
Expand Up @@ -2,14 +2,18 @@ import { HoppModule } from "."
import { plugin as HoppUI, HoppUIPluginOptions } from "@hoppscotch/ui"
import { useKeybindingDisabler } from "~/helpers/keybindings"
import { useI18n } from "vue-i18n"
import { delay } from "lodash-es"
const { disableKeybindings, enableKeybindings } = useKeybindingDisabler()

import "@hoppscotch/ui/style.css"

const HoppUIOptions: HoppUIPluginOptions = {
t: (key: string) => useI18n().t(key).toString(),
onModalOpen: disableKeybindings,
onModalClose: enableKeybindings,
onModalClose: () => {
// Delay the activation of keybindings after closing a modal to prevent unintended execution of keybindings that are meant for the main application context, not the modal.
delay(enableKeybindings, 1000)
},
}

export default <HoppModule>{
Expand Down

0 comments on commit 5bbdc58

Please sign in to comment.