17th June 2026
Tool
<click-to-play> — a still that plays
— `<click-to-play>` is a web component that turns a linked still image into a tap-to-play animation. Without JavaScript, the element is a plain link to a GIF. Once defined, it intercepts the click, preloads the GIF off-screen, and swaps it in for the still so playback starts at the first frame. A second tap returns to the still, and the page shows the play, loading, and error states along with the component's source and a copy button.
A progressive enchantment Web Component that turns this markup:
<click-to-play>
<a href="URL to GIF">
<img src="URL to first frame" alt="...">
</a>
</click-to-play>
Into a still frame with a click to play button which loads the GIF on demand. For when you don't want big GIFs to be loaded unless people want to play them.
Here's an example that demonstrates the new row editing tools in Datasette - in fact I built this Web Component for that post.
Recent articles
- Hello Python 3.15, goodbye 3.10, and now I can use 3.11 - 12th October 2026
- A new feature for my blog, built using my voice - 9th October 2026
- Claude Haiku 5.5 - 7th October 2026
- We're going to need default hard budget caps on pretty much everything - 3rd October 2026