Add preserve-scroll modifier to x-navigate directive

- Use x-navigate.preserve-scroll to maintain sidebar scroll position during navigation
- Prevents page from scrolling to top after clicking sidebar links
- Alpine navigate automatically saves and restores scroll position
This commit is contained in:
2025-12-04 02:17:13 +09:00
parent 1e20982e00
commit a4aff43091
2 changed files with 2 additions and 2 deletions

View File

@@ -18,7 +18,7 @@
@auth
<div class="mt-6 pt-6 border-t border-gray-200">
<a
x-navigate
x-navigate.preserve-scroll
href="{{ route('documents.create') }}"
class="flex items-center justify-center px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-md hover:bg-indigo-700"
>

View File

@@ -8,7 +8,7 @@
$displayTitle = basename($file['document']->title);
@endphp
<a
x-navigate
x-navigate.preserve-scroll
href="{{ route('documents.show', $file['document']) }}"
class="flex items-center px-2 py-1.5 text-sm text-gray-700 rounded hover:bg-gray-100 group"
>