Chrome Opens HTML-in-Canvas Trial to Unify 3D Graphics and Native DOM

Build next-generation UIs with the HTML-in-Canvas API — Chrome for Developers

Chrome for Developers

The HTML-in-Canvas API eliminates the historic trade-off between graphics performance and web usability by rasterizing live DOM trees directly into WebGL and WebGPU textures while preserving native accessibility, translation, and text selection.

AI-assisted summary of Build next-generation UIs with the HTML-in-Canvas API — original source. Check the original for full context.

Source published:

Key ideas

  • Chrome launched the HTML-in-Canvas API into Origin Trial as of May 2026, allowing developers to paint standard DOM elements directly into 2D canvas, WebGL, or WebGPU textures while preserving full accessibility and interactivity. (14:40)
  • The API resolves the historic trade-off between canvas rendering performance and DOM semantics, maintaining native text selection, browser translation, and perfect 100 Lighthouse accessibility scores inside GPU pipelines. (10:00)
  • Major industry software creators—including Figma, Adobe, Miro, and JetBrains—are actively prototyping with the API to eliminate redundant custom text layout engines and restore native browser affordances. (14:40)
  • Open-source 3D graphics ecosystems have integrated early abstractions, with Three.js offering THREE.HTMLTexture and PlayCanvas supporting direct DOM texture binding alongside dedicated WebGL and WebGPU API primitives. (6:55)

Detailed notes

## Background Published on YouTube by Chrome for Developers on May 21, 2026, this Google I/O 2026 session is presented by Thomas Nattestad to introduce the HTML-in-Canvas API. According to the video description, the talk covers how the API enables developers to render standard HTML elements directly into canvas and texture pipelines while retaining full interactivity, accessibility, and dynamic texture manipulation.

## TL;DR Thomas Nattestad introduces the HTML-in-Canvas API, a native platform capability designed to bridge the historic divide between rich DOM semantics and high-performance Canvas, WebGL, and WebGPU rendering. By marking a canvas with layoutSubtree, invoking element rasterization methods, and synchronizing layout geometry with CSS transforms, developers can draw live UI components directly into graphics pipelines without losing native text selection, accessibility trees, or browser integrations. The presentation showcases practical demonstrations ranging from interactive 3D books with live localization to refractive WebGL shaders that preserve Find-in-Page search highlights. Supported across frameworks like Three.js and PlayCanvas, the API launched as an Origin Trial in Chrome in May 2026 and is being actively explored by major industry tools such as Figma, Adobe, and JetBrains.

## Atmosphere & style The presentation carries the energetic, polished, and developer-focused tone typical of Google I/O engineering keynotes, blending architectural explanations with eye-catching live visual demos. Thomas Nattestad speaks with pragmatic enthusiasm, directly validating long-standing developer frustrations around canvas text layout and broken accessibility before unveiling native platform solutions. Watching the session feels both inspiring and grounded, featuring relatable personal anecdotes about living abroad and relying on browser translation, alongside humorous asides about mandatory conference mentions of AI.

## Bulletin - [14:40](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=880s) Chrome launched the HTML-in-Canvas API into Origin Trial as of May 2026, allowing developers to paint standard DOM elements directly into 2D canvas, WebGL, or WebGPU textures while preserving full accessibility and interactivity. - [10:00](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=600s) The API resolves the historic trade-off between canvas rendering performance and DOM semantics, maintaining native text selection, browser translation, and perfect 100 Lighthouse accessibility scores inside GPU pipelines. - [14:40](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=880s) Major industry software creators—including Figma, Adobe, Miro, and JetBrains—are actively prototyping with the API to eliminate redundant custom text layout engines and restore native browser affordances. - [06:55](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=415s) Open-source 3D graphics ecosystems have integrated early abstractions, with Three.js offering THREE.HTMLTexture and PlayCanvas supporting direct DOM texture binding alongside dedicated WebGL and WebGPU API primitives.

## Key takeaways - [00:00](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=0s) Rendering UIs in traditional Canvas, WebGL, or WebGPU pipelines strips away vital browser functionality like screen readers, native text selection, find-in-page search, and translation. - [03:19](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=199s) The HTML-in-Canvas setup begins by marking the canvas with layoutSubtree and nesting standard HTML markup between the canvas tags. - [03:19](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=199s) In 2D contexts, elements are rendered using drawElementImage() inside an onPaint listener, which returns a transformation matrix that must be synchronized with element.style.transform. - [03:19](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=199s) Developers must explicitly clean up and unmount unused canvas DOM elements, or they will linger as phantom elements within the accessibility tree. - [05:43](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=343s) Hardware-accelerated 3D contexts use texElementImage2D() for WebGL and copyElementImageToTexture() for WebGPU, substituting standard image assets with live DOM element references. - [05:43](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=343s) To keep interactions aligned on 3D meshes, developers must project 3D surface coordinates back to 2D viewport coordinates using canvas.getElementTransform(). - [06:55](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=415s) Three.js and PlayCanvas provide high-level abstractions that wrap HTML elements directly into materials and automatically manage repaint updates. - [06:55](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=415s) Software polyfills can provide visual fallbacks on unsupported browsers, though native browser features like accessibility trees require engine-level implementation. - [10:00](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=600s) Canvas-embedded DOM elements remain inspectable in Chrome DevTools and can achieve a perfect 100 accessibility score in Lighthouse audits. - [11:15](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=675s) Advanced GPU shaders like refraction and mesh distortion can manipulate living DOM elements without breaking native cursor dragging or in-page find shortcuts. - [12:45](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=765s) Rendering text as genuine DOM nodes inside 3D models allows instant typographic and styling changes via CSS without custom text layout engines. - [12:45](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=765s) Native browser translation services can automatically translate copy rendered onto dynamic 3D geometry without requiring bespoke localization pipelines. - [12:45](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=765s) Preserving genuine DOM structures inside graphics pipelines allows search engine crawlers, screen readers, and AI browsing agents to ingest content without optical character recognition. - [14:40](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=880s) WebGPU applications can bind procedural physics shaders and material deformations directly to reactive HTML input controls. - [14:40](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=880s) The HTML-in-Canvas API is available as an Origin Trial in Google Chrome as of May 2026, with active standardization discussions occurring across major browser vendors.

## Detailed walkthrough ### [00:00](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=0s) Introduction to the HTML-in-Canvas API and the Divide Between DOM and Canvas

Thomas Nattestad introduces the HTML-in-Canvas API, a capability designed to allow developers to paint standard DOM content directly into a `<canvas>` element or into WebGL and WebGPU textures. The critical breakthrough is that even when rendered inside high-performance graphics pipelines, the UI remains fully interactable, accessible, and connected to native browser functionality. Nattestad previews several cutting-edge demos using familiar HTML techniques in unprecedented ways before breaking down the motivation behind the API: bridging the historic divide between the DOM and the Canvas.

```mermaid flowchart TD accTitle: Comparison of DOM and Canvas characteristics accDescr: Diagram illustrating the contrasting trade-offs between the rich semantics of the DOM and the low-level rendering power of Canvas.

subgraph DOM["Traditional DOM & HTML"] D1["Rich semantic layout & native text engine"] D2["Browser integration: A11y, Translate, Autofill, Zoom"] D3["Native interactions: Copy/paste, right-click context menu"] end

subgraph Canvas["Canvas (WebGL / WebGPU)"] C1["Low-level pixel grid control"] C2["High-performance 2D & 3D rendering"] C3["Requires manual text layout & breaks native browser features"] end

DOM ---|"HTML-in-Canvas Bridge"| Canvas ```

To explain the core problem, Nattestad distinguishes between HTML (the static source markup authoring the structure) and the DOM (the live, interactive object model built and maintained by the browser runtime). The traditional DOM serves as the bedrock of web UI, offering responsive text engines, semantic hierarchy, and built-in interactive affordances like dragging to select text or right-clicking images to save them. It also seamlessly hooks into deep browser ecosystems, including screen readers, translation engines, find-in-page searches, reader view, browser extensions, dark mode, system zoom, and form autofill.

Conversely, Canvas, WebGL, and WebGPU grant low-level control over a raw grid of pixels, essential for performance-intensive apps like games or Google Docs. However, canvas elements sacrifice the entire browser feature layer. Developers are traditionally forced to implement complex text layout engines or pull in heavy third-party layout libraries, bloating bundle sizes while completely severing accessibility and native text interaction. As Thomas Nattestad puts it, “All these features I prattled off earlier for the DOM break completely when the UI is rendered into a canvas.” The HTML-in-Canvas API acts as a native bridge to unite these two worlds without forcing developers to choose between graphics power and accessibility.

- The API is available in Chrome, with active standards engagements underway with other major browser vendors to establish it as an open web standard. - The workflow operates in three distinct phases: canvas setup, painting/rendering into a canvas or texture, and updating CSS transforms to notify the browser of layout geometry.

---

[03:19](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=199s) Core API Setup: Canvas Preparation and 2D Context Rendering

Implementing the API begins by enabling the browser engine to recognize the internal DOM tree through the `layoutSubtree` property on the target `<canvas>` element. Placing `layoutSubtree` on the canvas signals the browser layout engine to measure, hit-test, and expose its nested contents to accessibility tools and other browser services. Developers place standard HTML markup directly between the `<canvas>` tags (either written statically in the markup or injected dynamically via JavaScript).

```mermaid flowchart LR accTitle: HTML-in-Canvas rendering lifecycle accDescr: Three-step lifecycle showing how nested canvas HTML is laid out, painted via drawElementImage, and positioned with CSS transforms.

A["Set layoutSubtree on canvas & nest HTML"] --> B["Paint with drawElementImage() inside onPaint"] B --> C["Apply returned transform to element.style.transform"] C --> D["Native hit-testing, selection & A11y restored"] ```

Nattestad emphasizes that placing HTML markup within `<canvas></canvas>` is a necessary prerequisite, but it does not render the elements on its own. Drawing requires an explicit render invocation. In a standard 2D canvas context, developers call `drawElementImage()`, passing the DOM element reference alongside the target X and Y canvas coordinates. The ideal time to execute this drawing call is inside the `onPaint` event listener, which fires whenever the element requires a repaint—such as when a user drags a selection cursor over text or when browser utilities like find-in-page highlight search matches.

Crucially, `drawElementImage()` returns a transformation matrix. Developers must map this returned transform directly onto the DOM element's `style.transform` property. Setting this transform ensures that the browser's hit-testing boundaries and accessibility overlays track precisely with where pixels were rasterized onto the canvas surface. Nattestad stresses lifecycle management: whenever elements are repainted, their transform must be refreshed; if an element is no longer drawn, it must be removed from the canvas tree so accessibility engines do not continue presenting a phantom element to assistive hardware. Furthermore, developers must manage high-DPI displays by listening to a `ResizeObserver` to sync canvas width and height against device scale factors to prevent rendering blurriness.

- Calling `layoutSubtree` prepares the internal DOM tree for hit-testing, accessibility trees, and browser-level integrations. - “This is so that interactivity and browser functionality works automatically with no additional integrations,” Nattestad emphasizes regarding synchronizing the transform. - Failure to unmount or remove unused canvas DOM nodes causes them to linger indefinitely in the accessibility tree.

---

[05:43](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=343s) Modern 3D Graphics: WebGL, WebGPU, and 3D Transformations

Rendering DOM nodes within hardware-accelerated 3D contexts follows the same foundational pattern: establishing `layoutSubtree` and nesting the markup, but changing the rasterization method to target textures instead of a flat 2D context. In WebGL, developers use `texElementImage2D()`. This method mirrors the classic `texImage2D()` signature identically, substituting an image source parameter with a direct DOM element reference. For modern WebGPU applications, the API provides `copyElementImageToTexture()`, modeled directly after the standard `copyExternalImageToTexture()` call.

```mermaid flowchart TD accTitle: Texture mapping and transform projection pipeline in 3D accDescr: Pipeline depicting how DOM elements are rasterized into WebGL/WebGPU textures and projected back to CSS coordinate space.

subgraph Rasterization["Texture Upload"] WebGL["WebGL: texElementImage2D()"] WebGPU["WebGPU: copyElementImageToTexture()"] end

subgraph Mapping["Transform Synchronization"] M1["Project 3D world space to 2D viewport"] M2["Invoke canvas.getElementTransform()"] M3["Assign resulting matrix to element.style.transform"] end

Rasterization --> Mapping ```

While rasterizing DOM elements into a GPU texture is straightforward, maintaining proper interactivity in a dynamic 3D scene requires extra work. The developer must project the 3D surface coordinates back into the flat 2D viewport space of the browser window. To achieve this, developers compute a viewport projection transformation mapping 3D surface coordinates into CSS coordinate space, retrieve the proper placement via `canvas.getElementTransform()`, and assign that matrix to the DOM element's CSS `transform` style. This synchronizes interaction events, context menus, and selection boundaries with the textured 3D mesh as it rotates or translates across the scene.

- WebGL projects use `texElementImage2D()`, swapping an image or video source for an active DOM element reference. - WebGPU pipelines leverage `copyElementImageToTexture()` to copy element rendering into GPU-backed textures. - Mathematical mapping between 3D world-space coordinates and screen-space CSS coordinates is required to align browser hit-testing boundaries with dynamic 3D meshes.

---

[06:55](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=415s) Framework Support, Polyfills, and Practical Demonstrations

Because manual 3D coordinate transformations can be daunting, Nattestad highlights that popular open-source 3D engines have already abstracted away the low-level mathematics. Three.js features experimental support for the API via `THREE.HTMLTexture`. Developers instantiate an HTML texture by passing in the target DOM element, set it directly as the texture map on a standard material, attach that material to geometry such as a box mesh, and render it immediately.

```mermaid flowchart LR accTitle: Framework implementation in Three.js and PlayCanvas accDescr: Overview of how Three.js and PlayCanvas turn a DOM element into a texture map applied to 3D meshes.

subgraph ThreeJS["Three.js Pipeline"] T1["THREE.HTMLTexture(domElement)"] --> T2["Set material.map"] T2 --> T3["Attach to Mesh"] end

subgraph PlayCanvas["PlayCanvas Pipeline"] P1["Create pc.Texture()"] --> P2["texture.setSource(domElement)"] P2 --> P3["Repaint listener uploads texture"] P3 --> P4["Apply as diffuseMap"] end ```

PlayCanvas has similarly integrated native support for HTML-in-Canvas. In PlayCanvas, developers enable `layoutSubtree`, create a texture, and set its source to the designated HTML element via an event listener. A repaint listener then uploads the texture whenever the browser repaints the DOM content, ensuring animations and input updates stay synchronized. That texture is plugged into the material's `diffuseMap` and rendered onto a 3D model. Nattestad notes that the PlayCanvas demo contains feature-detection logic that falls back to a software polyfill if the browser lacks native API support. While polyfills cannot wire up native browser accessibility or selection hooks, providing a visual fallback remains an engineering best practice.

Nattestad then points to a real-world shoe customizer demo where interactive style selectors track with the user's cursor across a 3D surface while the underlying controls remain simple, accessible HTML. He also suggests using modern AI coding assistants (such as Antigravity) to bootstrap implementation code; since the API is newly minted, developers should prime these tools with the official specification explainer or the Modern Web Guidance documentation.

Transitioning into live examples, Nattestad showcases a complex typographical sample where native text is rendered inside a canvas running both right-to-left (RTL) and vertically top-to-bottom. Inspecting the element in Chrome DevTools confirms the text is physically laid out within the `<canvas>` tag, yet it retains full browser-native selection, context menus, and accessibility semantics.

- Three.js exposes the API through the simple `THREE.HTMLTexture(element)` constructor. - PlayCanvas wires the element into standard materials via `diffuseMap` combined with an automatic repaint listener. - Polyfills can serve as visual fallbacks on unsupported browsers, though native features like accessibility trees and translation hooks require native engine support. - Modern coding tools need context to write accurate code for this new API; Nattestad advises sharing the official explainer or Modern Web Guidance documentation links.

[10:00](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=600s) Accessibility, DevTools, and Interactive WebGL Textures

Even when elements are encapsulated directly inside a `<canvas>`, the HTML-in-Canvas API completely preserves accessibility semantics and developer tooling integration. Users can freely drag images around, open context menus with a right-click to save assets, or embed active SVG graphics. Crucially, the entire underlying semantic DOM tree is exposed directly to the accessibility tree view, ensuring screen readers can parse and navigate the content without friction. Thomas Nattestad highlights that developers do not have to compromise on standard web health audits: “And if we go over here into Lighthouse, we can see that we can even get an accessibility score of 100, even though all of that content is being put inside of the canvas.”

```mermaid flowchart TD accTitle: HTML in Canvas Architecture accDescr: Diagram illustrating how DOM elements feed into Canvas textures while preserving DevTools and browser features.

subgraph DOM ["Standard DOM Elements"] A["HTML Markup & CSS"] B["Input Sliders & Text"] end

subgraph HIC ["HTML-in-Canvas Engine"] C["Texture Rasterization"] D["Accessibility Tree & Lighthouse"] end

subgraph Render ["GPU Pipeline"] E["WebGL / WebGPU 3D Scene"] F["Custom Shaders (Refraction & Distortion)"] end

A --> C B --> C A --> D C --> E E --> F D -.->|"Maintains full parity"| E ```

Moving beyond flat 2D rendering, Nattestad showcases a WebGL implementation where an interactive UI is painted directly into a 3D texture. Despite being rendered as a texture map, users can interact with text fields, drag input sliders, and type text natively. Because standard DevTools remain wired up behind the scenes, developers can right-click any rendered part of the 3D surface, select "Inspect", and see the live DOM nodes. Changing properties directly within the DevTools element inspector triggers instant live updates on the 3D texture while maintaining full interactivity and responsiveness to native browser behaviors, such as automatically switching palettes when the browser toggles system dark mode.

- **Lighthouse Performance**: Canvas-embedded DOM trees can achieve a perfect 100 accessibility score. - **Live DevTools Inspection**: Right-clicking 3D canvas textures allows developers to inspect, edit attributes, and alter styles in real time. - **System Integration**: Canvas UI dynamically updates to system-level CSS changes, including dark mode preferences.

---

[11:15](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=675s) Advanced WebGL Shaders: Refraction, Distortion, and In-Page Search

The API seamlessly bridges complex visual shaders with live DOM components. In a digital billboard demonstration, an animated SVG pencil renders in real time directly onto a WebGL texture, playing continuous vector animations without requiring bespoke rendering code or sacrificing user interactivity. Nattestad presents an example of a glass-like 3D model placed as an overlay across standard UI elements: when adjusting an input slider behind the glass, the DOM element dynamically refracts through the physical contours of the 3D mesh.

Browser built-in utilities work through these complex visual effects without breakage. When triggering Chrome’s native Find in Page shortcut to search for words like "specimen", the browser's search highlights appear on screen and warp according to the geometry of the refractive 3D model. The same holds true for interactive mouse-driven text distortion shaders. Users can drag their cursor to warp paragraphs describing the experimental API, drag-select sections of the distorted copy, and see native text selection highlights conform to the real-time GPU displacement. As Nattestad observes: “And if you wanted to, again, find in page, all of this just works automatically and hooked up through the same HTML that you know and love.”

- **Animated Vectors**: Animated SVGs render natively into canvas textures and loop without custom canvas draw loops. - **Optical Shaders**: Refraction and distortion shaders can manipulate living UI elements without breaking hit testing. - **Native Browser Features**: Text selection, cursor drags, and native Find in Page (`Cmd+F` / `Ctrl+F`) continue functioning through GPU fragment shaders.

---

[12:45](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=765s) The 3D Book Demo: Dynamic Typography, Localization, and AI Readability

To demonstrate a realistic production use case, Nattestad presents a fully interactive 3D book rendered with WebGL. Rather than relying on static textures or custom text layout engines, the book's pages are laid out with standard HTML and CSS. Developers can instantly alter the typographic styling through the DOM, swapping out fonts to match the literary aesthetic of *The Adventures of Sherlock Holmes* or toggling to a heavy, blocky typeface. The rendering engine dynamically re-rasterizes the text onto the 3D mesh while preserving text boundaries and alignment.

```mermaid flowchart LR accTitle: Real-time Dynamic Page Updates accDescr: Demonstrating how DOM mutations propagate directly to 3D book pages.

A["DOM Mutation / Font Swap"] --> B["HTML-in-Canvas Re-render"] B --> C["3D WebGL Book Geometry"] D["Chrome Translate Engine"] --> B E["AI Agents & Web Crawlers"] -.->|"Direct Read Access"| A ```

This DOM foundation also unlocks native browser localization. Reflecting on his daily life, Nattestad shares a personal connection: “Speaking as somebody who lives in a country where I don't speak the language perfectly, a really important feature for me is the browser provided translate.” By triggering Chrome's built-in translation tool, the text inside the 3D book immediately updates into German—displaying *Die Abenteuer des Sherlock Holmes* across the pages without altering the underlying 3D scene architecture. This unlocks fully localized 3D experiences without forcing developers to build custom translation pipelines.

Furthermore, preserving an accessible HTML document tree resolves the long-standing "black box" problem of canvas rendering for external software. Jokingly admitting that “it wouldn't be Google I/O unless I also have the chance to at least somewhere mention AI,” Nattestad demonstrates how search engine indexing crawlers, AI browsing agents, and browser text-extractor extensions read and extract text from the 3D pages. Because the text remains genuine DOM text, autonomous agents and screen readers can ingest the copy, process the chapters, and read the book aloud without needing complex optical character recognition (OCR).

- **Dynamic Typography**: Layout, sizing, and font families update dynamically on the 3D model via standard CSS. - **Native Localization**: Built-in browser translation tools automatically translate text wrapped in 3D canvas textures. - **Machine Readability**: Search crawlers and AI agents can query, copy, and extract text without OCR workarounds.

---

[14:40](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=880s) WebGPU Integration, Industry Adoption, and Origin Trial

The capabilities of HTML-in-Canvas extend naturally into modern WebGPU pipelines. Nattestad presents an interactive WebGPU demo featuring an elastic "jelly slider" that deforms and refracts over dynamic numerical values. Modifying the underlying input element's attributes within Chrome DevTools—such as changing the slider's `step` attribute from 1 to 5—updates the WebGPU physics and rounding math on the fly, proving that low-level graphics APIs can stay synchronized with standard browser form controls.

Industry software creators are already leveraging the API to optimize complex web apps. Major design, productivity, and IDE vendors—including Figma, Adobe, Miro, and JetBrains—have begun prototyping with the technology to unify their heavy canvas rendering pipelines with native DOM accessibility and typography. Nattestad emphasizes the production readiness and next steps for developers: “As of May 2026, the API is an origin trial, which means you can already experiment with deploying it to production in Chrome, but you will have to sign up your origin at this link to enable the API.” The session concludes with an invitation to join the community showcase, encouraging developers to experiment with the demos, build novel UI experiences, and submit their work to the official "Awesome HTML in Canvas" repository.

- **WebGPU Support**: Works with next-generation WebGPU shaders, physical materials, and interactive form attributes. - **Early Industry Partners**: Figma, Adobe, Miro, and JetBrains are actively prototyping use cases with the API. - **Release Status**: Launched into Origin Trial as of May 2026 for production testing in Google Chrome. - **Community Resources**: Demos, explainers, and showcase links are aggregated in the Awesome HTML-in-Canvas repository.

## Notable quotes > [12:45](https://www.youtube.com/watch?v=TUtKGTeFWjQ&t=765s) Speaking as somebody who lives in a country where I don't speak the language perfectly, a really important feature for me is the browser provided translate. — Thomas Nattestad

## Mentioned Thomas Nattestad, HTML-in-Canvas API, DOM, Canvas, WebGL, WebGPU, Chrome, Google Docs, Three.js, PlayCanvas, Antigravity, Chrome DevTools, Lighthouse, The Adventures of Sherlock Holmes, Figma, Adobe, Miro, JetBrains, Google I/O 2026

## Video description Learn how the HTML-in-Canvas API lets you draw HTML elements directly into a canvas while maintaining semantic information like accessibility and interactivity. then explore how to manipulate textures to create dynamic effects that still feel like interactive websites. We will cover the extensive capabilities of this API, review demonstrations of potential use cases, and understand the initial setup process.

Resources: https://goo.gle/HIC-how-to https://goo.gle/HIC-threejs https://goo.gle/HIC-threejs-example https://goo.gle/HIC-playcanvas https://goo.gle/HIC-playcanvas-example https://goo.gle/HIC-playcanvas-shoe https://goo.gle/HIC-explainer https://goo.gle/HIC-MWG https://goo.gle/HIC-samples https://goo.gle/awesome-HIC https://goo.gle/hic-central

Speakers: Thomas Nattestad

Watch the Chrome sessions from Google I/O 2026 → https://goo.gle/Chrome-at-IO2026

Subscribe to Chrome for Developers → https://goo.gle/ChromeDevs

#GoogleIO

Event: Google I/O 2026

Products Mentioned: Web, Chrome, Design

[Source](https://www.youtube.com/watch?v=TUtKGTeFWjQ)

Reading summary

Thomas Nattestad introduces the HTML-in-Canvas API, a capability in Chrome designed to bridge the historic divide between low-level graphics rendering and semantic web functionality by painting live DOM elements into 2D canvas, WebGL, and WebGPU contexts without sacrificing accessibility or native browser features. Bridging DOM Semantics and High-Performance Graphics (0:00) Traditionally, developers face a stark trade-off between the DOM and hardware-accelerated canvas environments. Standard DOM elements provide native text layout, copy-paste, screen reader compatibility, translation engines, and form autofill, but lack low-level pixel control. Canvas, WebGL, and WebGPU offer high-performance rendering for applications like games and Google Docs, yet historically break all browser-level integrations and force teams to build custom text and layout engines, inflating bundle sizes. The HTML-in-Canvas API acts as a native bridge, allowing interactive HTML markup to render directly into graphics pipelines while preserving semantic accessibility. Core Mechanics: Layout Trees and Transform Synchronization (3:19) Implementation relies on three distinct phases: preparation, painting, and transform tracking. Adding the `layoutSubtree` property to a target `<canvas>` element signals the browser engine to lay out, measure, and hit-test nested DOM nodes. For 2D contexts, elements are rendered via `drawElementImage()`—ideally called within the `onPaint` event listener when repaints are needed, such as during text selection. Hardware Acceleration across WebGL and WebGPU (5:43) In 3D environments, rasterization methods adapt to GPU textures rather than flat contexts. WebGL developers use `texElementImage2D()`, swapping an image source for an active DOM element reference, while WebGPU pipelines employ `copyElementImageToTexture()`. To keep mouse interactions and context menus aligned with rotating or translated 3D meshes, developers must project 3D surface coordinates back to the flat 2D viewport, retrieve the placement matrix using `canvas.getElementTransform()`, and map it to the element's CSS `transform` style. Open-source 3D engines have started abstracting this math, including experimental support in Three.js via `THREE.HTMLTexture` and integrated diffuse mapping in PlayCanvas with software polyfill fallbacks. Preserving Browser Tooling, Shaders, and Localization (10:00) Even when encapsulated within 3D textures, elements remain live DOM nodes that score up to 100 on Lighthouse accessibility audits and can be inspected or edited directly through Chrome DevTools. Complex visual effects—including animated SVG textures, glass refraction models, and mouse-driven text distortion shaders—continue to support native interactions such as cursor drag selection and built-in Find in Page (`Cmd+F` / `Ctrl+F`). In a showcase WebGL 3D book demo, standard CSS updates fonts on the fly, Chrome's native translation engine localizes page copy into German without modifying scene geometry, and AI agents or search crawlers can index and extract text without needing optical character recognition. As of May 2026, the HTML-in-Canvas API is available as an origin trial in Chrome, with active standards engagements underway with other major browser vendors. Major productivity and design software creators, including Figma, Adobe, Miro, and JetBrains, have begun prototyping with the API to combine canvas rendering pipelines with native DOM accessibility.

Source quotes

[12:45] Thomas Nattestad: Speaking as somebody who lives in a country where I don't speak the language perfectly, a really important feature for me is the browser provided translate.

Original transcript

[0:00] - Hi everyone, my name is Thomas, and today I'm here to introduce the HTML in Canvas API. This API lets you draw DOM content directly into a canvas or a WebGL and WebGPU texture while keeping the UI interactable, accessible, and hooked up to your favorite browser features. All the demos that you see here are using the HTML that you know and hopefully love in ways that you never thought possible. We'll get back to these, but first, let me tell you a little bit more about this API. In this talk, we'll go over the basics of HTML and Canvas and why each is great and even better together. I'll then show you how you can start using the API today for your own project through some simple lines of code. And finally, I'll show off some more of those cool demos and show you how you can apply the API directly. To really understand the API, let's first look closely at the DOM and Canvas to understand their relative strengths. I'll use DOM and HTML somewhat interchangeably, but generally speaking, HTML is the static source code you write, while the DOM is the live interactive model the browser builds from that code. As you'll see, this API changes both the static HTML on the page and updates the live DOM structure to enable interactivity. The DOM is the staple of WebUI and has incredible features hooked up through the browser. It offers great UI and text layout solutions out of the box that leverages semantically understood content to create rich and interactable interfaces. It enables users to do common operations across web pages, including simple things we take for granted, like selecting text to copy or right-clicking an image to save it. There are also a ton of browser integrations for features like accessibility, translate, find in page, reader mode, extensions, dark mode, browser zoom, and autofill, which are all pivotal to how users interact with the web. Canvas, along with WebGL and WebGPU, on the other hand, give developers low-level access to enable highly advanced 2D and 3D graphics. The power of Canvas is that it is a low-level system that can use various rendering stacks like WebGPU or rendering frameworks to drive that grid of pixels. Games and many web apps like Google Docs that have complex UI need this performant low-level access. However, because the canvas is just a grid of pixels with some basic functionality, you'll need to handle a lot of logic like responsive text layout yourself or through a framework which adds to your bundle cost. Additionally, All these features I prattled off earlier for the DOM break completely when the UI is rendered into a canvas. Until now, that is. The HTML and Canvas API is the bridge that gives you the best of both worlds by letting you paint DOM elements into a Canvas or WebGPU texture. And the best part is that by putting the HTML inside the canvas tag and updating the transform, the content not only remains interactable, but all the browser features I mentioned stay hooked up too. The API is available in Chrome today, and we're actively engaged with other browsers on the open standard and hope to see it shipping across browsers in the future. Using the API is done in three phases: setting up your canvas, rendering into the canvas or into a texture, and finally updating the transform of the element to tell the browser where it actually is. Let's look at each of those steps through some code. The first thing to do is to set the layout subtree property on the canvas tag you're painting into. This causes the browser to be aware of the content in the canvas and sets it up to be hit tested and exposed to systems like accessibility and browser features. You can then just write the HTML code within the canvas tags, such as adding a form element and input. And you can write this HTML directly as you're authoring or programmatically add it through JavaScript. Putting the HTML inside the canvas tags is a prerequisite to rendering it, but it is not sufficient. Rendering the element will require an explicit API call through a 2D context, WebGL, or WebGPU, which we'll take a look at next. For a 2D context, the call is drawElementImage, which takes the DOM element and an X and Y location of where to draw the element into the canvas. In this example, we're doing this through the onPaint event, which triggers whenever the element is getting redrawn, including when the user or something like FindInPage highlights the text. [5:00] This is the best way to make sure the UI is always updated, but you can do this wherever it makes sense for your application. The API method returns a transform that you can then apply to the CSS style transform property of the DOM object to let the browser know where the element is being rendered. This is so that interactivity and browser functionality works automatically with no additional integrations. It's vital that you update this transform whenever you repaint the element. If you stop painting the element, it's also critical to remove it from the canvas element, or else it'll keep being presented to the browser and accessibility systems as being part of the page. An important step is to set the width and height of the canvas to the right scale factor, so that you avoid blurriness when rendering. To do this, you just need to make sure to add these few lines of code to set a resize observer. For WebGL, you still need to set the layout subtree property and add the HTML you wish to render inside of that canvas. To then paint the element into a texture, you'll use textElementImage2D, which matches exactly to the textImage2D WebGL method, and takes the same arguments, except instead of an image source, you pass in a reference to the DOM element. For rendering using WebGPU, we also set up the canvas in the same way. Then we use the copy element image to texture method, which is similarly analogous to WebGPU's copy external image to texture method, which you may be familiar with. So those two functions just paint the DOM element into a texture, But just like in the 2D example, it's also critical that we update the CSS transform of the element so that the browser knows where it is on the screen. Doing this in 3D space is a bit more complex and I won't show the full code here. but you can see it in this code sample. At a high level, we apply a viewport transformation to map the 3D coordinate spaces to the CSS coordinate space. and then use the canvas provided getElementTransform To get a transform we can then apply the same way that we did for the 2D case. That's all a little difficult and confusing, but luckily that's why we have amazing frameworks to help do that heavy lifting so that you can focus on easily using the feature. I'm happy to share that 3.js has already landed experimental support for HTML and Canvas, which you can dig into more at this link. Using the API with 3.js is very simple. You can create a material and then set the map of that material using the new 3.html texture method. passing in the DOM element to be rendered. Then you just create a mesh using some geometry like a box. and applying that material and boom! Another framework that has also landed support is the Play Canvas framework, which lets you build stunning HTML5 games and visualizations. The setup here is also very simple where you set up your canvas with layout subtree create an HTML element, and then create a play canvas texture. We then add an event listener that sets the source of that texture to be the HTML element we want to be rendered. Finally, we add an event listener that just uploads the texture whenever the browser repaints the elements so that it always stays up to date. Now that we have the HTML texture, we can use it as the diffuse map of a material, which we can then apply to a cube, and once again, boom. It's worth highlighting that this example will also detect if the API isn't available and fall back to using a polyfill for rendering. While this doesn't hook up the browser features, it is always a best practice to provide a fallback for your own projects as well. You can see the full code sample at this link. For a more complex example, you can see the shoe demo. where the style selector moves along with the cursor to give a stunning 3D effect, while leveraging simple HTML for the UI. Of course, nowadays amazing coding tools like Antigravity and a host of others can also help do a lot of this coding for you. Because this is a brand new API, a lot of coding tools won't know about the API unless you provide it with context. You can pass in the explainer link and suggest the coding tool to reference the examples. But even better is utilizing the modern web guidance linked here, which will help the coding tool understand everything it needs to know for using the API. So now that we know the basics of the API, let's walk through some examples to showcase the full power of the API in practice. All of these examples can be found on the page at this link. In this first example, we have some text being rendered both right to left and up and down. And if we look over here into DevTools, we can see that it is indeed inside of the canvas element itself. And we can still [10:00] do things like drag the image around or right-click to save it, and there's even a little SVG working there as well. Accessibility information is now also exposed, even though this element is inside of the canvas, And if we come over here into the accessibility tree view, you can see all of that content which would be accessible to, for example, a screen reader. And if we go over here into Lighthouse, we can see that we can even get an accessibility score of 100, even though all of that content is being put inside of the canvas. In a slightly more practical world, we have this simple WebGL example where you can see this UI is painted into a texture. but I can actually still utilize the text, utilize the slider, or input text myself. And then because it's all just hooked up through DevTools, I can even right-click on this and say inspect to see this UI right here. And I can actually even say, well, this is actually a super simple control. And you can see that the UI will just update there automatically while staying fully interactive and exposed to all the other browser features as well. And finally, if your CSS respects dark mode, then you can actually go in here and say update your browser customization to dark mode and the UI will just update accordingly. Now, if you wanted something that looked a little bit more like a real billboard, you could also make something like this. And this is cool because this little pencil that you see here is actually an animated SVG It is now being rendered not only into the canvas as an animated SVG, but directly into the WebGL texture itself. And so now you can just play these SVGs without any kind of additional code. And of course, all of the text and interactivity remains fully functional as well. If you want to have something like a visually stunning overlay utilizing a 3D model, you can also do that. You can see here that you can still utilize the slider and it'll actually refract through the 3D model itself. And similarly, if I wanted to do something like find in page, I can go in here and search for a specimen. And you can see that even that piece here will also refract through the 3D model appropriately. You can also do this really neat text distortion effect as you drag the mouse around and learn about this experimental API for rendering HTML directly into a WebGL texture. And this again just works as basic UI. And if you wanted to, you can even select the text and see that the effect is being applied to that selection of text. And if you wanted to, again, find in page, all of this just works automatically and hooked up through the same HTML that you know and love. Now we have perhaps again just a slightly more practical example of something that you might actually want to do. Here you can see a kind of 3D book that has all been rendered using WebGL. And again, this all just works as text being laid out thanks to the HTML in Canvas API. Because this is all just laid out with the DOM and HTML, I can even go in here and decide I maybe want a more classical font to read Sherlock Holmes in. and it'll just update in there directly. Then I say, "Okay, maybe that isn't really too easy for me to read, so I want something more like blocky and funny looking and can select out here this different text and boom!" It all just updates that font and you can really just choose anything that you want. So we'll go ahead and switch it back to a more normal font so that we can kind of see what we're looking at. And now I want to talk about perhaps one of my own personal favorite parts of this API. Speaking as somebody who lives in a country where I don't speak the language perfectly, A really important feature for me is the browser provided translate. And so I'm able to go in here and just use that translation to say translate this over into German. and read "Die Abenteur des Sherlock Holmes" and it just automatically updates all of that different text. That means that I can now have these beautiful 3D scenes while still letting my users pick any language that they want to experience that in. Now, it wouldn't be Google I/O unless I also have the chance to at least somewhere mention AI, and that's actually another place where this API comes in handy. because all of this is just text exposed in the html tree something like an indexing crawler or an ai agent would be able to engage with all of it as just text. So let's say I wanted my agent to extract all of the text in all of these different pages rather than having to leaf through them. Maybe I wanted to read it out loud to me. I can then go in and have something like an agent or even a simple extension like a text extractor. use that as an access to text directly. Because it's alters text, myself or an agent can then copy out this text, maybe somewhere to read it out loud. This last example is actually a WebGPU example, and here we can see this fun jelly slider that some of you may have seen before, but now it actually refracts fully and correctly with this little number right here. And of course, since it's all just hooked up through an input slider, we can even go over here into the DevTools. and say changing the step from a one to a five and boom it automatically updates [15:00] so that it rounds to the nearest five and is still very fun and engaging, while of course also staying hooked up to those browser features. Even in this early stage of the API, it's already getting some amazing apps like Figma, Adobe, Miro, and JetBrains, who have all started prototyping and exploring what the API can enable for their web apps. As of May 2026, the API is an origin trial, which means you can already experiment with deploying it to production in Chrome, but you will have to sign up your origin at this link to enable the API. So hopefully that gives you an overall sense of the API, how to use it, and what it enables for you to create. So now all that's left is for you to go and create something amazing And, of course, share what you make. We have an awesome HTML in Canvas readme file where we're hoping to keep track of some of the incredible things people are making. and there's a submission link for you to include your own amazing creations or finds. And with that, I just want to say thank you for listening today, and I can't wait to see some of the amazing ways that you'll use this API. Thank you.