Examples: Emscripten: add tabindex=-1 to canvas in shell_minimal.html. (#9259)

Without tabindex, the canvas element is not focusable in the DOM, so pongasoft/emscripten-glfw's focus/blur listeners on the canvas
never fire. This means glfwSetWindowFocusCallback is never called etc.
Ref: https://github.com/pongasoft/emscripten-glfw/issues/29
This commit is contained in:
Pascal Thomet
2026-02-22 16:35:57 +01:00
committed by ocornut
parent 37b7a7a9df
commit 2000008b47
2 changed files with 4 additions and 1 deletions

View File

@@ -46,6 +46,9 @@ Other Changes:
- Style: border sizes are now scaled (and rounded) by ScaleAllSizes().
- Clipper: clear DisplayStart/DisplayEnd fields when Step() returns false.
- Examples:
- Emscripten: added `tabindex=-1` to canvas in our shell_minimal.htm. Without it,
the canvas was not focusable in the DOM, which in turn make some backends
(e.g. pongasoft/emscripten-glfw) not receive focus loss events. (#9259) [@pthom]
- WGPU: fixed undefined behaviors in example code for requesting adapter
and device. (#9246, #9256) [@r-lyeh]

View File

@@ -29,7 +29,7 @@
</style>
</head>
<body>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()" tabindex=-1></canvas>
<script type='text/javascript'>
var Module = {
preRun: [],