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.
This commit is contained in:
Pierre Ossman 2017-10-18 17:01:34 +02:00
parent 1150497123
commit 458086177c
2 changed files with 6 additions and 1 deletions

View File

@ -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);

View File

@ -331,7 +331,7 @@
autocorrect="off" autocomplete="off" spellcheck="false"
mozactionhint="Enter" tabindex="-1"></textarea>
<canvas id="noVNC_canvas" width="0" height="0" tabindex="-1">
<canvas id="noVNC_canvas" width="0" height="0">
Canvas not supported.
</canvas>
</div>