Fix sidebar scroll preservation per page with x-navigate directive

- Add x-navigate directive to all sidebar document links for Alpine navigation
- Store scroll position per page using URL path as key in sessionStorage
- Each page now maintains its own scroll position in the sidebar
- Save scroll position before navigation and restore after navigation
- Scroll position is preserved when clicking links in the sidebar
- Works correctly with Alpine navigate events triggered by x-navigate directive
This commit is contained in:
2025-12-04 02:11:06 +09:00
parent 00a5951654
commit ec7aaf44a9
3 changed files with 54 additions and 44 deletions

View File

@@ -18,6 +18,7 @@
@auth
<div class="mt-6 pt-6 border-t border-gray-200">
<a
x-navigate
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"
>