Preserve sidebar scroll position when navigating between documents
- Add x-navigate:scroll directive to sidebar container to maintain scroll position - Add x-navigate:scroll to all document links in sidebar (tree-item.blade.php) - Add x-navigate:scroll to 'New Document' button - When clicking a link in sidebar, the sidebar scroll position is now preserved during page navigation - Fixes issue where sidebar would scroll to top after loading a document
This commit is contained in:
@@ -200,6 +200,7 @@ class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 ring-1 ring
|
||||
<div class="flex h-[calc(100vh-4rem)]">
|
||||
<!-- Sidebar - Desktop -->
|
||||
<aside
|
||||
x-navigate:scroll
|
||||
class="hidden lg:block bg-white border-r border-gray-200 overflow-y-auto relative"
|
||||
:style="'width: ' + sidebarWidth + 'px'"
|
||||
>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
@auth
|
||||
<div class="mt-6 pt-6 border-t border-gray-200">
|
||||
<a
|
||||
x-navigate: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"
|
||||
>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
$displayTitle = basename($file['document']->title);
|
||||
@endphp
|
||||
<a
|
||||
x-navigate: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"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user