Hacker News new | ask | show | jobs
by zarzavat 119 days ago
Canvas is a last resort if you absolutely cannot build the thing any other way.

When you use canvas you're giving up on not just accessibility but also optimizations that the browser does for you transparently when you use the native render tree. There's no guarantee that your app will be faster in canvas, it could easily be slower. Do you really think you can beat the browser's C++ by writing code in a language that doesn't even have a native integer type? Perhaps you can, but your base assumption should be that you can't.

2 comments

You’re not “giving up” on accessibility. You’re just not getting it “for free” — though it was never free to begin with.

When you’re dealing with things like spreadsheet viewers, disengaging from the DOM for sighted users can actually make accessibility simpler.

> disengaging from the DOM for sighted users can actually make accessibility simpler.

Do you have any examples? In my experience, a lot of software written like this just doesn't work with screen readers at all.

Can WASM write to Canvas though?
You need some JS in the middle but yes, you write your image to a buffer and share it with JS, then in the JS you put it in the canvas.
WASM can call javascript, and javascript can call canvas. You can use JS bridges to let WASM do more or less anything.