Ver código fonte

Avoid force-scrolling the minimap when unneeded

Thibaud Colas 2 anos atrás
pai
commit
b7c04ed960
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2 1
      client/src/components/Minimap/Minimap.tsx

+ 2 - 1
client/src/components/Minimap/Minimap.tsx

@@ -45,7 +45,8 @@ const updateScrollPosition = (list: HTMLOListElement) => {
     'a[aria-current="true"]',
   );
 
-  if (activeLinks.length === 0) {
+  // Don’t update the scroll position if there are no links, or all links are visible.
+  if (activeLinks.length === 0 || list.scrollHeight === list.clientHeight) {
     return;
   }