fix(10): resolve CR-01 prop mutation + CR-02 double-shortcut on modal open

CR-01: DocumentCard.vue `@unshared="doc.is_shared = false"` mutated a
defineProps prop (readonly in Vue 3). Replace with a local `isShared` ref
watched against prop changes so the Shared pill hides correctly after revoke.

CR-02: App.vue keyboard handler fired U/N/Escape shortcuts even when a modal
was open (no input focused). Add `role="dialog"` guard so all shortcuts are
suppressed while any dialog is in the DOM.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
curo1305
2026-06-16 10:16:28 +02:00
co-authored by Claude Sonnet 4.6
parent 37f49bc6ea
commit efd6c78a15
2 changed files with 7 additions and 3 deletions
+1
View File
@@ -30,6 +30,7 @@ function onOsFilesDropped(files) {
function onKeydown(e) {
const tag = document.activeElement?.tagName
if (['INPUT', 'TEXTAREA', 'SELECT'].includes(tag) || document.activeElement?.isContentEditable) return
if (document.querySelector('[role="dialog"]')) return
if (e.key === '/' && !e.ctrlKey && !e.metaKey) {
e.preventDefault()
@@ -36,7 +36,7 @@
</div>
<!-- Shared indicator pill -->
<div v-if="doc.is_shared" class="mt-2">
<div v-if="isShared" class="mt-2">
<span class="bg-indigo-50 text-indigo-600 text-xs font-medium px-2 py-1 rounded-full">Shared</span>
</div>
@@ -83,7 +83,7 @@
v-if="showShareModal"
:doc="doc"
@close="showShareModal = false"
@unshared="doc.is_shared = false"
@unshared="isShared = false"
/>
</div>
@@ -113,7 +113,7 @@
</template>
<script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { ref, computed, watch, onMounted, onUnmounted } from 'vue'
import AppIcon from '../ui/AppIcon.vue'
import { useTopicsStore } from '../../stores/topics.js'
import { useFoldersStore } from '../../stores/folders.js'
@@ -128,6 +128,9 @@ const props = defineProps({
const emit = defineEmits(['reclassified'])
const isShared = ref(props.doc?.is_shared ?? false)
watch(() => props.doc?.is_shared, v => { isShared.value = v ?? false })
const topicsStore = useTopicsStore()
const foldersStore = useFoldersStore()
const showShareModal = ref(false)