Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,13 @@ var ngramTypeConfig = {
this.nextPhrase();
}
},
preventSpace: function(e) {
// don't update `this.typedPhrase` if the first character entered is a space
if (e.key === ' ' && this.typedPhrase === '') {
e.preventDefault()
return
}
},
resetCurrentPhraseMetrics: function() {
this.hitsCorrect = 0;
this.hitsWrong = 0;
Expand Down
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ <h4 v-show="!data[data['source']].phrases.length">
:class="{'form-control': true, 'form-control-lg': true, 'incorrect-input': !isInputCorrect}"
id="input-typing" type="text" autocorrect="off" autocapitalize="none"
placeholder="Re-type if failed, press <TAB> or <ESC> to reset" spellcheck="false"
v-on:keyup="keyHandler">
v-on:keyup="keyHandler"
v-on:keydown="preventSpace">
</div>
</div>
<!--Lesson end-->
Expand Down