From 191cc667e17d8ecc3de8d2fabb132bae9f1576f9 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 20 Apr 2021 12:22:31 +0900 Subject: [PATCH] internal/uidriver/js: Add an error message when pointerlockerror happens Updates #1604 --- internal/uidriver/js/ui_js.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/uidriver/js/ui_js.go b/internal/uidriver/js/ui_js.go index 60ef4de06..cb353ac9c 100644 --- a/internal/uidriver/js/ui_js.go +++ b/internal/uidriver/js/ui_js.go @@ -396,6 +396,10 @@ func init() { theUI.input.recoverCursorPosition() return nil })) + document.Call("addEventListener", "pointerlockerror", js.FuncOf(func(this js.Value, args []js.Value) interface{} { + js.Global().Get("console").Call("error", "pointerlockerror event is fired. 'sandbox=\"allow-pointer-lock\"' might be required.") + return nil + })) } func setWindowEventHandlers(v js.Value) {