Skip to content

Commit

Permalink
Fix prompt-mode which i broke on the last merge
Browse files Browse the repository at this point in the history
  • Loading branch information
MarmadileManteater committed Jan 28, 2025
1 parent 52fd574 commit 96788e1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/renderer/components/FtPrompt/FtPrompt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<script setup>
import { nextTick, onBeforeUnmount, onMounted, ref } from 'vue'
import { useId } from '../../composables/use-id-polyfill'
import android from 'android'
import store from '../../store/index'
Expand Down Expand Up @@ -113,6 +114,10 @@ const promptCard = ref(null)
let promptButtons = []
let lastActiveElement = null
function exitPrompt() {
hide()
}
onMounted(() => {
lastActiveElement = document.activeElement
document.addEventListener('keydown', handleEscape, true)
Expand All @@ -121,11 +126,19 @@ onMounted(() => {
promptButtons = Array.from(promptCard.value.$el.querySelectorAll('.btn.ripple, .iconButton'))
focusItem(0)
})
if (process.env.IS_ANDROID) {
android.enterPromptMode()
window.addEventListener('exit-prompt', exitPrompt)
}
})
onBeforeUnmount(() => {
document.removeEventListener('keydown', handleEscape, true)
nextTick(() => lastActiveElement?.focus())
if (process.env.IS_ANDROID) {
android.exitPromptMode()
window.removeEventListener('exit-prompt', exitPrompt)
}
})
/**
Expand Down

0 comments on commit 96788e1

Please sign in to comment.