Skip to content

Commit 7e02c31

Browse files
MikhailGorobetsTheMostDiligent
authored andcommitted
Emscripten: Fixed input from keyboard
1 parent bb3e744 commit 7e02c31

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

SampleBase/src/Emscripten/resources/emscripten_template.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@
3232
</style>
3333
</head>
3434
<body>
35-
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
35+
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
3636
<script type='text/javascript'>
3737
var Module = {
3838
preRun: [],
39-
postRun: [],
39+
postRun: function() {
40+
var canvas = document.getElementById('canvas');
41+
if (canvas)
42+
canvas.focus();
43+
},
4044
print: (function () {
4145
return function (text) {
4246
text = Array.prototype.slice.call(arguments).join(' ');

0 commit comments

Comments
 (0)