Skip to content

Commit

Permalink
Merge pull request #4121 from traPtitech/feat/close_file_modal_on_esc
Browse files Browse the repository at this point in the history
モーダルを開いてるときにescキーを押したら閉じられるように
  • Loading branch information
mehm8128 authored Jan 6, 2024
2 parents 7133947 + 018ef2b commit ca5871a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/UI/FilterInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:data-disable-ime="$boolAttr(disableIme)"
:enterkeyhint="enterkeyhint"
@input="onInput"
@keydown.esc="reset"
@keydown.esc.stop="reset"
@keydown.enter="emit('enter')"
/>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/store/ui/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ const useModalStorePinia = defineStore('ui/modal', () => {
}
}

window.addEventListener('keydown', e => {
if (e.key === 'Escape' && shouldShowModal.value) {
popModal()
}
})

return {
isOnInitialModalRoute,
isClearingModal,
Expand Down

0 comments on commit ca5871a

Please sign in to comment.