fix search keybinds on small screens

This commit is contained in:
swithek 2026-10-12 11:21:25 +02:00
parent cb7435db2c
commit 51017df74a
3 changed files with 8 additions and 8 deletions

View File

@ -310,7 +310,7 @@ describe("<AppSidebar>", { concurrent: false }, () => {
)
})
it("asks to open the search modal from the search row", async ({
it("asks to toggle the search modal from the search row", async ({
expect,
}) => {
stubQueries()
@ -320,9 +320,7 @@ describe("<AppSidebar>", { concurrent: false }, () => {
"click",
)
expect(
document.body.querySelector("[data-slot='dialog-content']"),
).not.toBeNull()
expect(sidebar(wrapper).emitted("toggle-search")).toHaveLength(1)
})
it("asks to toggle the notification sidebar from the inbox row", async ({

View File

@ -21,6 +21,7 @@ const emit = defineEmits<{
e:
| "initial-load-complete"
| "toggle-notifications"
| "toggle-search"
| "toggle-shortcuts"
| "toggle-settings",
): void
@ -45,7 +46,6 @@ const { useFetchNotificationCount } = useNotificationAPI()
const fetchNotificationCount = useFetchNotificationCount({ read: false })
const editorStore = useEditorStore()
const { openExternalLink } = useExternalLinks()
const isSearchModalOpen = ref(false)
const wsState = useWebSocketStateStore()
let unsubWsTreeChange: (() => void) | null | undefined = null
let unsubWsTagTreeChange: (() => void) | null | undefined = null
@ -56,7 +56,7 @@ useShortcut(SHORTCUT_ACTIONS.toggleSidebar.keyboardKey, () => {
toggleSidebar()
})
useShortcut(SHORTCUT_ACTIONS.searchForDocuments.keyboardKey, () => {
isSearchModalOpen.value = !isSearchModalOpen.value
emit("toggle-search")
})
useShortcut(SHORTCUT_ACTIONS.toggleInbox.keyboardKey, () => {
emit("toggle-notifications")
@ -152,7 +152,7 @@ const sections = computed<Section[]>(() => {
name: t("sidebar.sections.top.search-button"),
icon: "lucide:search",
onClick: () => {
isSearchModalOpen.value = true
emit("toggle-search")
},
acceptsChildren: false,
active: false,
@ -588,6 +588,5 @@ async function installSlack() {
</ShadcnUiSidebarFooter>
</div>
</Transition>
<SearchModal v-model="isSearchModalOpen" />
</ShadcnUiSidebar>
</template>

View File

@ -140,6 +140,7 @@ const createLoading = ref(false)
const settingModalOpen = ref<
boolean | "org-members" | "github" | "metric-data-sources"
>(false)
const searchModalOpen = ref(false)
const shortcutsModalOpen = ref(false)
const pendingDocDeletion = ref<{
deleteDocument: () => Promise<void>
@ -743,6 +744,7 @@ function clearLinkedBlock() {
@delete-document="handleDocumentDeletion"
@delete-tag="handleTagDeletion"
@open-settings="(target) => (settingModalOpen = target)"
@toggle-search="searchModalOpen = !searchModalOpen"
@toggle-settings="settingModalOpen = !settingModalOpen"
@toggle-shortcuts="shortcutsModalOpen = !shortcutsModalOpen"
@toggle-notifications="toggleNotificationSidebar"
@ -753,6 +755,7 @@ function clearLinkedBlock() {
v-model="settingModalOpen"
@refresh-organization-slug="refreshOrganizationRouteSlug"
/>
<SearchModal v-model="searchModalOpen" />
<ShortcutModal v-model="shortcutsModalOpen" />
<EditorBlocksMetricsConfigModalBaseModal
@open-settings="() => (settingModalOpen = 'metric-data-sources')"