Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

Livewire full-page components user account menu show problem


Hi,

I use livewire full-page component. I have default layout and in this layout i use metronic layout. On the first page open user account menu open on hover but after i click other page (i use wire:navigate), user account menu is not opening on hover.

I can give my code example if needed


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (7)


HI,

Use your browser's developer tools (e.g., Chrome DevTools) to inspect the user account menu elements. Check for any JavaScript errors or warnings in the console that might indicate issues with scripts or event handling.

Ensure that any JavaScript initialization or event binding code is executed in the appropriate component lifecycle hooks, such as wire:initialized, to ensure it runs when the component is first loaded.

Please share your code example, we can check it further if the issue persist.

Thanks



Hi,

Firstly i check for developer tools but no error on any after wire:navigate .

Here is my code blocks;

https://codeshare.io/Adwwll


Some javascript actions is working after wire:navigate. For example #kt_app_sidebar_toggle is working perfectly. But hoverable actions is not workink.

I might this about is re-render full body. Script is same nothing change but after body change javascript can not access user account menu dom. Maybe livewire has some answer about that but i don't find anything.



Apologise for the delay. One possible cause of your problem is that Livewire does not re-render the entire page when you use wire:navigate, but only updates the parts that have changed. This might interfere with some of the JavaScript events or scripts that are attached to the user account menu elements.

One possible solution is to use wire:ignore on the parent element of the user account menu, so that Livewire does not touch it at all. For example, you can try something like this:

< div wire:ignore>
{ {-- Your user account menu code goes here... --}}
< /div>



Yes i try this but user account menu in layout page and livewire just take own part. For example;

components > layouts > app.blade.php;
!User account menu is here

livewire > profile > settings
!Modul here

And if i put wire:ignore on app.blade.php, livewire not see that.


This is not problem, i gave up using.



Apologize for inconvenience. For some reason, the hover dropdown menu not working after use wire:navigate. Maybe you can try this approach. Everytime you navigate, reinitialize the dropdown menu. but the init code is in javascript.


<script>
document.addEventListener("livewire:load", function () {
Livewire.on("mount", function () {
KTMenu.init();
});
});
</script>


Thanks



I have had the same issue for days, tried so many things but none of the suggested fixes work.

As soon as I use wire:navigate the menus stop working.

I tried Livewire.on -> KTMenu.init() and that doesn't work either.



I have had the same issue for days, tried so many things but none of the suggested fixes work.

this reference working for other template,
https://www.youtube.com/watch?v=gkDq2E6g0F0

this is my code :

#sidebar.blade.php
My Sidebar Code



#script.blade.php

@livewireScripts
<script>

document.addEventListener("DOMContentLoaded", () => {
console.log("dom loaded");
});
document.addEventListener("livewire:navigated", () => {
console.log("navigated");
KTComponents.init()
KTMenu.init();
})
// document.addEventListener("livewire:load", function () {
// Livewire.on("mount", function () {
// KTMenu.init();
// });
// });

</script>

i have tried to add data-navigate-once on script tag

My script code


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(