navigation bar fixed on the active navigation item
When the navigation items become too many, when I select a navigation item that is on the bottom of the navbar and I have to scroll for it, the page refreshes and the navbar goes back to the top. Is there a way to mantain the navbar position where the selected navbar item is?
8 Replies
I use this code to do that
and you can add render hook in the panel provider
works wonders, thank you for the suggestion!
I thought filament had something for that kind of behavior.
will this work for v3
i am bit confused of the file structure like where to create this filament.hooks.footer.php.
yes it's working for v3 too
notice the function
view
so it's a blade file,
filament.hooks.footer.blade.php
create it in
views/filament/hooks/footer.blade.php
you can also check the docs on the render hook
this is my code for navigation
and i am getting null for const activeSidebarItem = document.querySelector('.fi-sidebar-item-active');
am i missing something.
Does it only happen when you have the nav-bar collapsed?
no even if there is no nav-bar collapsed i am facing same problem.
If you are completely overriding the entire navigation as it appears to be the case in your code, you aren’t assigning an active state to any of the navigation items. ->isActiveWhen()
https://filamentphp.com/docs/3.x/panels/navigation#registering-custom-navigation-items-1