From 458086177c97761392359222a3be6db8ad1eae78 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 18 Oct 2017 17:01:34 +0200 Subject: [PATCH] Let RFB object make sure canvas can have focus Let's set up things properly ourselves instead of forcing everyone to create their canvas element just like we want it. --- core/rfb.js | 5 +++++ vnc.html | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/rfb.js b/core/rfb.js index 811170a5..284a01bb 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -147,6 +147,11 @@ export default function RFB(defaults) { // main setup Log.Debug(">> RFB.constructor"); + // Target canvas must be able to have focus + if (!this._target.hasAttribute('tabindex')) { + this._target.tabIndex = -1; + } + // populate encHandlers with bound versions this._encHandlers[encodings.encodingRaw] = RFB.encodingHandlers.RAW.bind(this); this._encHandlers[encodings.encodingCopyRect] = RFB.encodingHandlers.COPYRECT.bind(this); diff --git a/vnc.html b/vnc.html index be1fc18b..40d89c7f 100644 --- a/vnc.html +++ b/vnc.html @@ -331,7 +331,7 @@ autocorrect="off" autocomplete="off" spellcheck="false" mozactionhint="Enter" tabindex="-1"> - + Canvas not supported.