scroll to game beginning: better fix
[vchess.git] / client / src / components / MoveList.vue
index 6f7b4dc..da70e34 100644 (file)
@@ -109,7 +109,10 @@ export default {
       // $nextTick to wait for table > tr to be rendered
       this.$nextTick(() => {
         let curMove = document.querySelector(".td.highlight-lm");
-        if (curMove) {
+        if (!curMove && this.moves.length > 0)
+          // Cursor is before game beginning, and some moves were made:
+          curMove = document.querySelector(".moves-list > .tr:first-child > .td");
+        if (!!curMove) {
           curMove.scrollIntoView({
             behavior: "auto",
             block: "nearest"
@@ -188,6 +191,11 @@ img.inline
   @media screen and (max-width: 767px)
     height: 18px
 
+#scoreInfo
+  margin: 10px 0
+  @media screen and (max-width: 767px)
+    margin: 5px 0
+
 span.score
   display: inline-block
   margin-left: 10px