Hacker News new | ask | show | jobs
by thomasnowhere 81 days ago
Impressive that you built the rendering layer from scratch on Canvas. Curious about one thing though, how do you handle accessibility? With contenteditable you get a lot of browser accessibility features for free (screen readers, selection, input methods). With Canvas rendering you'd need to reimplement most of that manually.

I've been working on a ProseMirror-based editor and the biggest lesson was how much the browser gives you for free with contenteditable, even though it's painful to work with. IME input handling alone took weeks to get right, and that's with the browser doing most of the heavy lifting. Starting from Canvas seems like an order of magnitude harder.

How's the IME/CJK input working? And does it play nice with browser spellcheck?

1 comments

I developed my own selection and input handling. The app focuses on a hidden input and it extracts the events when you hit keys, and handles them in my editor engine. I haven't done extensive testing but it works pretty well for foreign languages, I've even added decent support for RTL ones like Arabic.

I haven't thought much about accessibility, it's not really a priority for the project right now. If the project really gets big I might revisit that. Google docs is canvas-based, so that was enough precedent for me.

That makes sense, the hidden input approach is clever. Google Docs definitely proved it's viable at scale. The RTL support is a nice touch, that's notoriously tricky to get right.

Great work pulling this off in 10 months. Good luck with the project!

thanks! appreciate that