Fixes
[vchess.git] / client / src / components / MoveList.vue
index 70756cc..1e19a2b 100644 (file)
@@ -25,14 +25,16 @@ export default {
        props: ["moves","cursor","score","message"],
   watch: {
     cursor: function(newValue) {
+      if (newValue < 0)
+        newValue = 0; //avoid rows[-1] --> error
       // $nextTick to wait for table > tr to be rendered
       this.$nextTick( () => {
         let rows = document.querySelectorAll('#movesList tr');
         if (rows.length > 0)
         {
           rows[Math.floor(newValue/2)].scrollIntoView({
-            behavior: 'smooth',
-            block: 'center'
+            behavior: "auto",
+            block: "nearest",
           });
         }
       });