From a073f48faf70e27b260d0d3ca1b6931c7c728830 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 13 Oct 2018 17:57:36 +0900 Subject: [PATCH] input: Bug fix: keypress event were not fired This change suspends to 'preventDefault' on keydown events. Now preventing navigation by pressing backspace is deprecated in Chrome. For other keys, it looks like keyup's preventDefault is enough to disable the browser default behavior. --- internal/ui/ui_js.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/ui/ui_js.go b/internal/ui/ui_js.go index ccc5e7535..ca17b0a87 100644 --- a/internal/ui/ui_js.go +++ b/internal/ui/ui_js.go @@ -325,7 +325,7 @@ func init() { canvas.Get("style").Set("outline", "none") // Keyboard - canvas.Call("addEventListener", "keydown", js.NewEventCallback(js.PreventDefault, input.OnKeyDown)) + canvas.Call("addEventListener", "keydown", js.NewEventCallback(0, input.OnKeyDown)) canvas.Call("addEventListener", "keypress", js.NewEventCallback(js.PreventDefault, input.OnKeyPress)) canvas.Call("addEventListener", "keyup", js.NewEventCallback(js.PreventDefault, input.OnKeyUp))