The problem is probably rather in the view.
Have you tried to add wire:ignore to the avoid the scroll position to change ?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Heey everyone i am having this problem where i have multiple popups that are livewire components, the user goes trough all the steps in this popup and scrolls to the bottom and hits save . But then the next time the same popup is called for creating another entry the scroll position is still at the bottom. But i need it to be at the top.
I have already tried calling a javascript event to scroll the div element to the top but it fires it everytime before it is loaded.
After saving or when calling the new open dispatch we call the following
$this->dispatch('scrollToTop'); that fires the javascript function
function scrollToTop() {
console.log('called scroll to top');
let divElement = document.querySelector('#rondeForm');
console.log(divElement.scrollTop);
void divElement.offsetWidth;
divElement.scrollTop = 0;
console.log(divElement.scrollTop);
}
Unfortunately that doesnt help and i cant seem to figure it out. Thanks in advance
Please or to participate in this conversation.