Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: prevent quick search modal duplication from keyboard shortcuts

claude[bot]81466d956e8f
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php
index 1c5987e82b..defa7bf6c0 100644
--- a/resources/views/components/navbar.blade.php
+++ b/resources/views/components/navbar.blade.php
@@ -83,7 +83,17 @@
<x-version />
</div>
<div>
- <livewire:global-search />
+ <!-- Search button that triggers global search modal -->
+ <button @click="$dispatch('open-global-search')" type="button" title="Search (Press / or ⌘K)"
+ class="flex items-center gap-1.5 px-2.5 py-1.5 bg-neutral-100 dark:bg-coolgray-100 border border-neutral-300 dark:border-coolgray-200 rounded-md hover:bg-neutral-200 dark:hover:bg-coolgray-200 transition-colors">
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-neutral-500 dark:text-neutral-400" fill="none"
+ viewBox="0 0 24 24" stroke="currentColor">
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
+ d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
+ </svg>
+ <kbd
+ class="px-1 py-0.5 text-xs font-semibold text-neutral-500 dark:text-neutral-400 bg-neutral-200 dark:bg-coolgray-200 rounded">/</kbd>
+ </button>
</div>
<livewire:settings-dropdown />
</div>
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
index 47ea71ecc7..04ff8c7425 100644
--- a/resources/views/layouts/app.blade.php
+++ b/resources/views/layouts/app.blade.php
@@ -4,6 +4,8 @@
@if (isSubscribed() || !isCloud())
<livewire:layout-popups />
@endif
+ <!-- Global search component - included once to prevent keyboard shortcut duplication -->
+ <livewire:global-search />
@auth
<div x-data="{
open: false,
diff --git a/resources/views/livewire/global-search.blade.php b/resources/views/livewire/global-search.blade.php
index 0792dadfb2..0c3fc13bd2 100644
--- a/resources/views/livewire/global-search.blade.php
+++ b/resources/views/livewire/global-search.blade.php
@@ -29,6 +29,11 @@
}
},
init() {
+ // Listen for custom event from navbar search button
+ this.$el.addEventListener('open-global-search', () => {
+ this.openModal();
+ });
+
// Listen for / key press globally
document.addEventListener('keydown', (e) => {
if (e.key === '/' && !['INPUT', 'TEXTAREA'].includes(e.target.tagName) && !this.modalOpen) {
@@ -69,19 +74,6 @@
});
}
}">
- <!-- Search bar in navbar -->
- <div class="flex justify-center">
- <button @click="openModal()" type="button" title="Search (Press / or ⌘K)"
- class="flex items-center gap-1.5 px-2.5 py-1.5 bg-neutral-100 dark:bg-coolgray-100 border border-neutral-300 dark:border-coolgray-200 rounded-md hover:bg-neutral-200 dark:hover:bg-coolgray-200 transition-colors">
- <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 text-neutral-500 dark:text-neutral-400" fill="none"
- viewBox="0 0 24 24" stroke="currentColor">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
- d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
- </svg>
- <kbd
- class="px-1 py-0.5 text-xs font-semibold text-neutral-500 dark:text-neutral-400 bg-neutral-200 dark:bg-coolgray-200 rounded">/</kbd>
- </button>
- </div>
<!-- Modal overlay -->
<template x-teleport="body">