Skip to content
This repository was archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
focus input on mouse click
Browse files Browse the repository at this point in the history
  • Loading branch information
nrzull committed Jun 21, 2019
1 parent b604841 commit 3addbf2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ function showInput([definition]) {
setTimeout(() => {
elements.input.focus();
document.addEventListener("keydown", onKeydownEnterButton);
document.addEventListener("click", onBlur);
}, 0);
}

function hideInput() {
elements.inputBlock.classList.add("hidden");
elements.input.blur();
document.removeEventListener("keydown", onKeydownEnterButton);
document.removeEventListener("click", onBlur);
}

function addMessage([message]) {
Expand Down Expand Up @@ -148,6 +150,10 @@ function startScroll([definition]) {
scroll(definition);
}

function onBlur() {
elements.input.focus();
}

function stopScroll() {
state.scroll = false;

Expand Down

0 comments on commit 3addbf2

Please sign in to comment.