HTML-in-Canvas ships and could make the web a lot more creative...and a lot stupider
The Web’s Canvas element gave would-be webcassos space to draw whatever they fancied; now HTML controls come along for the ride.
After two years of development, Google's Chrome team has released the HTML-in-Canvas API with Chrome version 157. This new feature promises to revolutionize the way web pages are designed, offering richer, more interactive elements, but also presenting potential challenges. The API allows web developers to insert HTML commands within Canvas elements, expanding the possibilities for creating visually engaging web applications.
Previously, web designers had to choose between using standard HTML elements or raw canvas contexts when creating complex web apps. The HTML-in-Canvas API breaks down these limitations, enabling the combination of HTML and canvas graphics, and enhancing the overall user experience. The new API has been submitted to the WHATWG HTML Living Standard for inclusion, ensuring its compatibility across various web platforms.
Developers can now wrap HTML controls onto 3D objects, creating virtual books that users can flip through and copy text from. Videos can also be integrated into custom-shaped canvases, providing a more immersive viewing experience. The API works particularly well with JavaScript plug-ins, enabling the creation of intricate 3D environments using libraries like Three.js or the generation of data visualizations with D3.js.
However, with great power comes great responsibility. HTML-in-Canvas opens the door to a plethora of creative possibilities, but also presents the risk of unintentionally creating a messier and more confusing web experience. Developers have already begun experimenting with the API, crafting trippy demos and interactive applications. For instance, a "Margin Dragon" demo showcases a dragon slithering through the opening chapter of an online book, with the text smoothly reflowing around it.
While the potential for creativity is enormous, the API's implementation is not without its flaws. Some bugs and inconsistencies in CSS rendering, along with suboptimal synchronization with reactive frameworks, may hinder the user experience. Additionally, there are concerns about accessibility, as the API does not provide clear guidance on handling sensitive cross-origin data, potentially leading to silent failures for web maintainers.
As the web community grapples with the implications of HTML-in-Canvas, it is essential to strike a balance between innovation and usability. While the API holds tremendous potential for creators and developers, it is crucial to address the associated challenges and ensure that the web remains accessible, inclusive, and enjoyable for all users.
Written by urgent.news from The Register's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.