peutetre 1 day ago

> It’s going to be extremely hard to get even decent results without targeting real DOM instead of going pure-canvas, and you can’t get excellent results without doing so.

Sure you can. Google Docs switched to canvas three years ago: https://workspaceupdates.googleblog.com/2021/05/Google-Docs-...

This wasm application renders to canvas and works fine for me: https://bandysc.github.io/AvaloniaVisualBasic6/

This one too: https://flutterweb-wasm.web.app/

Flutter and Google Docs gave up on the DOM because they couldn't get it working well enough, consistently enough across browsers. When you draw to canvas you get more consistent results because you control all the drawing.

5
wiseowise 1 day ago

> Sure you can. Google Docs switched to canvas three years ago: https://workspaceupdates.g

You just need to be one of the critical projects for BigTech. Easy peasy, compared to <editor_command> index.html.

> This wasm application renders to canvas and works fine for me: https://bandysc.github.io/AvaloniaVisualBasic6/

Trying to select text on mobile Safari just selects whole canvas. Same for your Flutter example.

What a regression for web. Just so that a couple of snowflakes can use their fad of the day or can stay in their comfort zone.

RandomThoughts3 1 day ago

> Just so that a couple of snowflakes can use their fad of the day or can stay in their comfort zone.

Or because the DOM is a piece of technology designed for rendering documents and not web apps and with limitations which has been severely gimping proper rendering of web apps for the past decade despite a slew of libraries trying to fill the cracks with various amount of success. Whichever you prefer.

solarkraft 23 hours ago

> Or because the DOM is a piece of technology designed for rendering documents and not web apps

IDK, it seems to have been pretty successful at it to me, being of the most popular GUI frameworks currently, probably the most popular by a wide margin.

Being designed for documents it should exceed at rendering documents.

The problem isn’t on the DOM itself, it’s in mapping other frameworks to it. Of course it‘d be hard to port LibreOffice‘s rendering to the web, it‘d be a crazy amount of work to reach parity.

And it’s fine to argue that it doesn’t make sense at all to use the DOM for non-web document editing: OnlyOffice doesn’t do it either, as far as I’m aware.

It’s just a bummer to me since documents are exactly what the web was made for.

wiseowise 1 day ago

Java was made for TV controllers. Now it powers majority of enterprise.

JS was made to animate monkey on a screen, and now it powers internet.

Technologies start with one goal and evolve.

troyvit 20 hours ago

> We build our computer systems the way we build our cities: over time, without a plan, on top of ruins.

-- Ellen Ullman

jancsika 17 hours ago

My brain compares cities to planned suburban developments complete with their wonderful HOAs.

My brain concludes that Ellen thinks we are building our computer systems in the least bad way. :)

jhbadger 23 hours ago

The fact that there are so many alternative languages for the JVM or which transpile to Javascript suggests that (at least to many people) that neither were ideal choices for their current uses.

legacynl 22 hours ago

I think this actually shows the exact opposite.

That is like saying the existence of cargo trucks, pick-ups, minivans, campers, and rv's shows that the underlying 'internal combustion engine' technology is flawed.

I think it rather shows that the technology is so useful that it is able to spawn different implementations aimed at slightly different use cases.

eitland 1 day ago

Or because Google doesn't like open web technologies, standards and interoperability now that they are the king of the hill?

peutetre 1 day ago

How are WebAssembly and canvas not open web technologies?

homebrewer 22 hours ago

They're much harder to "disassemble" and applications written in them are much harder to modify and a relatively open DOM + JS model. Looks like a very promising technology for an ad company that's been pushing to make ad blockers significantly less effective, and has never let you install an adblocker into the most popular browser on the most popular platform in the world.

eitland 23 hours ago

I didn't say they weren't.

In the case of Google Docs kt might be because it is really convenient to use canvas because then it gets much harder for clients to do things Google don't like, i.e. interoperability.

In other cases, like in IE^h^hChrome and large Google products like Calendar and YouTube there have been some interesting cases I think.

CharlieDigital 23 hours ago

Is `HTMLDivElement` really that different from `class Rectangle`?

RandomThoughts3 22 hours ago

Yes, extremely.

A div element is a node in a tree which will be rendered by a very opiniated rendering engine adhering to a fairly strict set of standards, and which can be manipulated using a limited subset of technologies which are themselves fairly opinionated.

A class Rectangle can be pretty much whatever you want.

CharlieDigital 22 hours ago

   > A class Rectangle can be pretty much whatever you want
In what way can an `HTMLDivElement` not emulate a `class Rectangle`?

    - Both are rectilinear
    - Both have width, height
    - Both can have borders, backgrounds
    - Both can be positioned in various grid/layout systems
    - Both can contain child instances
    - Both can contain a variety of child nodes like `Text`
    - Both can be clipped and masked
    - Both can be layered
What can you do with a `class Rectangle` from a GUI perspective that you can't do with an `HTMLDivElement`?

RandomThoughts3 21 hours ago

A class Rectangle can be whatever you want. You can overload it. You can change everything including how it’s rendered. It doesn’t have to be any of the things you list.

A div element is a node in a tree which will be rendered by your browser in the way specified by the spec. You absolutely can’t freely do most of the actions you list to a div. There are severe limitations.

A div doesn’t at all emulate a class. Its semantically something completely different.

CharlieDigital 20 hours ago

    > A Rectangle component is a node in a component tree which will be rendered by your OS graphics library in the way specified by the spec. You absolutely can’t freely do most of the actions you list to a div. There are severe limitations.
No?

It seems like you're just talking about a `Rectangle` in the abstract rather than the real limitation that even `class Rectangle` is subject to the rules of the runtime engine that renders said `Rectangle`...in a component tree...with the restrictions of the OS/GUI framework...

RandomThoughts3 13 hours ago

> No?

No.

Rendering outside of a web browser gives you a lot more freedom when it comes to how you layout and render. Rendering engines don’t necessarily use components tree by the way.

Even gui frameworks (which is what I think you are talking about with OS graphic library) have layout engines which are a lot more powerful than css. Flexbox is a step in the right direction but still inferior to what some frameworks could do 20 years ago.

wiseowise 21 hours ago

So instead of standardized element that works pretty much the same on every browser, that can be inspected and controlled by virtually every tool that works with web I, as a user, get a binary blob, correct?

peutetre 1 day ago

> Trying to select text on mobile Safari just selects whole canvas. Same for your Flutter example.

Ah, so yet again Safari is the problem. The new Internet Explorer unfortunately.

wiseowise 1 day ago

It is the same on every browser.

And you can even control zoom/scale on desktop. Very accessible!

chrismorgan 11 hours ago

> And you can’t even control zoom/scale on desktop.

I must note (in the interest of factual accuracy, though as you see I loathe the approach) that this is not a fundamental limitation, just something that Flutter and probably ZetaOffice have chosen not to support. You can block such things in a DOM world too, and it’s stupidly common for app-like things to try to do so.

wiseowise 21 hours ago

Can’t*

nox101 1 day ago

> Google Docs switched to canvas three years ago:

And broke CJK and emoji input. They only fixed emoji input recently. CJK is still broken.

arcanemachiner 1 day ago

> CJK

"The shorthand collective name for the Chinese, Japanese, and Korean writing systems."?

jraph 22 hours ago

Yep. This is a very widespread acronym, though I can understand that it feels like obscure jargon the first time you run into it.

otabdeveloper4 16 hours ago

> couldn't get it working well enough, consistently enough across browsers

Google Docs literally doesn't work in Firefox. (Garbled text.)

For Google not working consistently across browsers is a feature, not a bug.

zelphirkalt 1 day ago

Google Docs' Writer (or whatever they call it) is a terrible child's toy, just like Word of Office 365. Functionality is severely limited compared to traditional word processors like LibreOffice.

> Flutter and Google Docs gave up on the DOM because they couldn't get it working well enough, consistently enough across browsers. When you draw to canvas you get more consistent results because you control all the drawing.

And as a side effect, of course if you require the canvas, you will also be able to abuse the canvas, to fingerprint users. It is strange, how those things seemingly always coincide when it comes to Google products.

rbanffy 19 hours ago

> Google Docs' Writer (or whatever they call it) is a terrible child's toy, just like Word of Office 365

I'd believe the vast majority of the user base has never noticed anything off with these applications. I have noticed one or two things missing in the in-browser PowerPoint and that's about it. If you want to do precise publication layout, Word (and Writer) are not the appropriate tools - you'll need something like InDesign.

jfengel 23 hours ago

For the vast majority of what I do, a toy is all I need.

This is the nasty catch-22. It is preferable to have a single tool that handles both simple and complex cases. But sometimes, you just can't make one tool that does both well. If you optimize for the hard cases, then most users will use only a tiny minority of the features.

Microsoft tried to work around that with the "ribbon", which tried to learn which features each individual uses. Users hated it.

So I keep around LibreOffice for the hard stuff, which I write perhaps once a year. And I use Google Docs every day.

peutetre 1 day ago

> Google Docs' Writer (or whatever they call it) is a terrible child's toy

It's a toy that's making Google a lot of money.

chrismorgan 1 day ago

Google Docs isn’t pure-canvas: they only switched their document area to use it for layout. Text rendering is still browser (necessary to keep performance even close), and all the rest of the UI is still DOM. Having thought extensively about it, I cannot come up with any advantage to the approach they’ve taken—neither the performance¹ nor the consistency² angles make any sense, and the product is actively worse because of it³. I’ve written more about it on HN at times, skim https://hn.algolia.com/?query=chrismorgan%20google%20docs&ty... for more. Seriously, having thought about it very carefully and reviewed the matter several times over the years, I honestly believe that they lied in their justifications.

Flutter… ugh, Flutter on the web is awful awful awful awful awful AWFUL AWFUL and I will hate you if you decide with open eyes to use it when you’re deliberately targeting the web.⁴ I lack energy to express my vitriolic loathing. Just go through https://hn.algolia.com/?query=chrismorgan%20flutter&type=com..., there’s lots of detailed explanation of specifically what’s bad, if you need it.

Avalonia Visual Basic 6? It’s the kind of thing where the limitations will show least, because of how limited it is. And also because it’s imitating (not quite the right word, but close enough) ancient software which itself wouldn’t work fully properly if run on current machines. Its text handling is dodgy, doesn’t do composition properly, scrolling is non-native, context menus are non-native which stops some things from working properly… but honestly that’s kinda the vibe they’re going for, so it’s not particularly upsetting.

Pure-canvas is irredeemably bad. With difficulty you can make some things decent even with it, but excellence is impossible with pure canvas.

Flutter and Google Docs did not give up on DOM for the reasons you cite. Google Docs, I honestly don’t understand why they gave up on DOM, the reasons they cited publicly genuinely don’t make sense. Flutter, it was because they don’t actually care about the web, it’s a third-class target, and too much of the way they design their API doesn’t port to DOM directly, so that making DOM a first-class citizen would have required compromises in their APIs that they were unwilling to make. But it was emphatically not about cross-browser consistency.

—⁂—

¹ Seriously, Google Docs is slower than it used to be, especially with higher latency and jitter.

² The parts they replaced had no consistency problems in any realistic browsers. Seriously. Their layout requirements are, in practice, really basic. The area where consistency can actually be a problem is text shaping and rendering, but they haven’t replaced that since it would tank performance.

³ My favourite example is keyboard navigation. It doesn’t match platform conventions, and that’s really irritating. Since we’re in this thread, LibreOffice also flouts platform conventions in this area, and it’s really irritating.

⁴ If you’re focusing on mobile and make a mobile app with Flutter and also put it on the web with Flutter because why not, better than nothing, I won’t like you very much, but I’ll at least understand. But if you’re saying “we need a web thing, how about we use Flutter”… no.

peutetre 1 day ago

> But if you’re saying “we need a web thing, how about we use Flutter”… no.

If you're making an application, there's really nothing special about the DOM.

You might as well control your drawing. That way you don't need to figure out cross browser incompatibilities all day.

And here's what someone who used to work on Google Docs has to say about it:

https://news.ycombinator.com/item?id=27133929

chrismorgan 1 day ago

Please look over my comments on HN about Flutter and pure-canvas and such. There are big problems. There is plenty special about the DOM that you lose and cannot gain back if you go pure-canvas. Links. Scrolling. Text handling. Composition. And various more.

Use DOM. Please use DOM.

Use canvas for an actual drawing canvas, but for the UI and anything else that’s largely text, use DOM.

peutetre 1 day ago

There aren't "big problems" because it works. When you put yourself in the corner of claiming "pure-canvas is irredeemably bad" when it's plainly not, then there's nothing practical on offer.

chrismorgan 1 day ago

“It works” is a terrible defence, because of the different degrees of working.

I’m describing various specific ways in which it doesn’t work properly, in ways that stop users from doing things they may legitimately want to do, or which will frustrate some users, and you’re just disregarding them. I’m not being vague in most of my complaints, I’m being very specific.

It’s like you have a screw, and it’s worn enough that sometimes it makes the screwdriver slip, but you’re saying “just be careful, maybe apply a little more pressure, and it still works”.

peutetre 1 day ago

> and you’re just disregarding them.

Of course. You're living in a world of your own imagined requirements. The practical reality is that there are plenty of use cases for this stuff, whether you like it or not. This stuff is fit for purpose for many purposes.

wiseowise 1 day ago

How the hell you can claim “it works” if you can’t even select text out of the box, lmao?

peutetre 1 day ago

Because I can select text out of the box.

wiseowise 1 day ago

Okay, this getting absurd. At this point I’m 90% convinced that you’re just trolling.

https://news.ycombinator.com/item?id=42252999

You can’t select text in neither of your provided samples on both PC and mobile in different browsers.

peutetre 1 day ago

You can. Text selection works, cut and copy and paste works, zooming works.

I don't know what you're doing.

erinaceousjones 20 hours ago

What about screen readers and mobile users? There's all these useful accessibility tools that would also have to be reinvented for canvas based apps.

Text selection and getting it to bring up a keyboard is iffy on the canvas-based things you linked to (I'm looking at them on Firefox for Android on a Pixel 6). Sure, the VB one is a desktop app. But the original (non canvas) version of that app likely worked with windows screen readers, and that is lost in this reincarnation onto the web. Good old fashioned DOM already has pretty good native accessibility support for mobile phone UI.

There's a lot of things that have been thought about when it comes to usability and accessibility, in both the web, and traditional desktop/mobile UI frameworks.

Reimplementing those UI frameworks in canvas in a browser environment requires mapping the a11y bits too, not just keyboard+mouse input and rendering to screen.

Not to mention Qt and Gtk and the older Android framework apps all use forms of markup and styling which are inspired by XHTML and CSS and document object models......

wiseowise 21 hours ago

Which browser/OS?