fix(apps): repair netbird login and iframe focus

This commit is contained in:
archipelago
2026-05-19 19:21:43 -04:00
parent eeb08fc78f
commit bd69ef41d5
13 changed files with 281 additions and 77 deletions
@@ -9,7 +9,13 @@
</div>
</Transition>
<div v-if="appUrl && !iframeBlocked" class="absolute inset-0 app-session-frame-scroll-host">
<div
v-if="appUrl && !iframeBlocked"
class="absolute inset-0 app-session-frame-scroll-host"
tabindex="-1"
@pointerdown="focusIframe"
@focusin="focusIframe"
>
<iframe
ref="iframeRef"
:key="refreshKey"
@@ -17,7 +23,7 @@
class="w-full h-full border-0 iframe-scrollbar-hide"
title="App content"
tabindex="0"
@load="$emit('iframeLoad')"
@load="handleIframeLoad"
@error="$emit('iframeError')"
/>
</div>
@@ -84,7 +90,7 @@ const props = defineProps<{
refreshKey: number
}>()
defineEmits<{
const emit = defineEmits<{
iframeLoad: []
iframeError: []
refresh: []
@@ -93,10 +99,20 @@ defineEmits<{
const iframeRef = ref<HTMLIFrameElement | null>(null)
function focusIframe() {
iframeRef.value?.focus({ preventScroll: true })
}
async function handleIframeLoad() {
emit('iframeLoad')
await nextTick()
requestAnimationFrame(focusIframe)
}
watch(() => [props.appUrl, props.refreshKey, props.iframeBlocked], async () => {
if (!props.appUrl || props.iframeBlocked) return
await nextTick()
iframeRef.value?.focus({ preventScroll: true })
requestAnimationFrame(focusIframe)
}, { immediate: true })
defineExpose({ iframeRef })