From 06912bd6c476d8836f966c6f7b97c25ed69b9215 Mon Sep 17 00:00:00 2001
From: Adam Procter <adamprocter@researchnot.es>
Date: Sat, 14 Mar 2020 16:34:26 +0000
Subject: [PATCH] fixed onboard keyboard shortcuts

Now pressing enter also progresses straight to microcosm
---
 CHANGELOG.md                   |  1 +
 app/src/components/OnBoard.vue | 16 +++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 959925c..88598c2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ _14th March 2020_
 ### Fixed
 
 - Safari reload bug on initial creation of microcosms
+- Pressing Enter allows quick onboard aswell, also no reload
 
 # 0.1.5
 
diff --git a/app/src/components/OnBoard.vue b/app/src/components/OnBoard.vue
index 053180c..1ce1347 100644
--- a/app/src/components/OnBoard.vue
+++ b/app/src/components/OnBoard.vue
@@ -9,7 +9,7 @@
       >about</a> section.
     </p>
 
-    <form v-show="parta">
+    <form v-show="parta" onsubmit="return false;">
       <h2>1</h2>
       <h3>microcosm</h3>
       <p>
@@ -26,11 +26,12 @@
         autocorrect="off"
         autocapitalize="none"
         autofocus
+        v-on:keyup.enter="createMicrocosm(), setFocus()"
       />
       <BaseButton buttonClass="onboard" @click="createMicrocosm(), setFocus()">+</BaseButton>
     </form>
 
-    <form v-show="partb">
+    <form v-show="partb" onsubmit="return false;">
       <h2>2</h2>
       <h3>object</h3>
       <p>
@@ -44,11 +45,13 @@
         autocorrect="off"
         autocapitalize="none"
         ref="objectname"
+        v-on:keyup.enter="setClient()"
       />
-      <BaseButton buttonClass="onboard" @click="setClient()">+</BaseButton>
+      <BaseButton buttonClass="onboard" @click="setClient(), setFocusTwo()">+</BaseButton>
     </form>
 
     <form v-show="partc">
+      <input type="text" hidden v-on:keyup.enter="letsGo()" ref="objectnametwo" />
       <h2>3</h2>
       <h3>start</h3>
       <BaseButton buttonClass="onboard" @click="letsGo()">+</BaseButton>
@@ -58,6 +61,7 @@
 
 <script>
 var delay = 100
+var delaytwo = 100
 
 export default {
   data: function() {
@@ -99,8 +103,14 @@ export default {
     setFocus() {
       setTimeout(this.readyFocus, delay)
     },
+    setFocusTwo() {
+      setTimeout(this.readyFocusTwo, delaytwo)
+    },
     readyFocus() {
       this.$refs.objectname.focus()
+    },
+    readyFocusTwo() {
+      this.$refs.objectnametwo.focus()
     }
   }
 }
-- 
GitLab