The HTML-in-Canvas API has officially launched in the stable version of Chrome 157. This feature allows developers to integrate interactive DOM elements directly into 2D, WebGL, and WebGPU contexts, bridging the gap between standard HTML accessibility and GPU-accelerated graphics performance.
Previously, developers had to choose between rendering text as pixels, which lacked accessibility and browser features, or overlaying HTML elements, which caused synchronization issues and performance overhead. The new API eliminates these trade-offs by enabling native browser functions like text selection, search, translation, and screen reader support within canvas elements.
The implementation involves declaring HTML elements for canvas rendering and using specific methods for different contexts. For 2D, the drawElementImage method is used, while WebGL and WebGPU utilize updateElementGeometry to synchronize DOM and pixel transformations without requiring manual CSS style recalculations.
Major 3D and graphics libraries have introduced support for this feature. Three.js offers experimental support via THREE.HTMLTexture, PlayCanvas uses setSource for HTML textures, Babylon.js provides BABYLON.HtmlTexture, and PixiJS includes support in version v8.19.0 through HTMLSource.






