1
0
mirror of https://github.com/morris/vanilla-todo.git synced 2025-08-20 21:02:10 +02:00

fix issues with input focus

This commit is contained in:
Morris Brodersen
2020-10-22 14:19:58 +02:00
parent cdffacc69d
commit 9a27e850e1
5 changed files with 37 additions and 10 deletions

View File

@@ -13,7 +13,7 @@ VT.TodoCustomList = function (el) {
'<div class="header">',
' <h3 class="title"></h3>',
' <p class="form">',
' <input type="text" class="input">',
' <input type="text" class="input use-focus-other">',
' <button class="app-button delete"><i class="app-icon" data-id="trashcan-16"></i></button>',
' </p>',
'</div>',
@@ -48,6 +48,10 @@ VT.TodoCustomList = function (el) {
saveOnBlur = true;
});
inputEl.addEventListener('focusOther', function () {
if (state.editing) save();
});
inputEl.addEventListener('keyup', function (e) {
switch (e.keyCode) {
case 13: // enter