Site list scrolls to top on every delete — fixing the missing keepScroll argument across 6 call sites
The symptom Every time a site was deleted from the WordPress Maintenance Manager site list, the page jumped back to the very top. In environments managing many sites, removing an item in the middle of the list forced users to scroll back down before they could act on the next one. The same behavior occurred in five other operations: drag-and-drop reordering, thumbnail fetching (running behind an…
Every time a site was removed from the WordPress Maintenance Manager site list, the page unexpectedly jumped to the top. This issue affected six different operations: deleting a site by index, drag-and-drop reordering, thumbnail fetching (while a modal was open), deleting categories or tags, and completing maintenance tasks. The same problem appeared in multiple places across the site.
The fetchSites() function was responsible for this behavior. It accepted two arguments - keepPage and keepScroll. When keepScroll was set to true, the scrollTo({top: 0}) call inside renderPage was suppressed. This had been working correctly since version 1.6.6.
However, the six call sites that refreshed the list after an operation had omitted the second argument, so it defaulted to false. Consequently, the scrollTo top functionality fired every time. The thumbnail case was particularly tricky because the refresh occurred asynchronously behind the scenes, causing the list to scroll unexpectedly.
The root cause was simply omitting the keepScroll argument. Each of the six call sites needed to explicitly pass keepScroll=true. By fixing this omission, the site list would behave consistently after deletions, reorders, and other operations.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.