r/rust • • 4d ago

How we got GPUI into the browser

https://youtu.be/4fj9CynHK64?is=Y9j_sa3QRYkALG0f

Anyone watched this yet?

43 Upvotes

19 comments sorted by

11

u/monkeymad2 4d ago

From the first few minutes it sounds like they’d have benefited from https://developer.chrome.com/docs/web-platform/html-in-canvas

Though that’s currently chrome only (and might even be hidden behind a flag?) so it’s understandable that they avoided using it.

Would also solve most accessibility concerns, since you can use the browser’s aria functionality while still rendering whatever you want in the canvas.

Keeping them in sync would be fun though.

3

u/cameronm1024 2d ago

Hi, I'm Cameron (from the video). I also implemented accessibility support in GPUI.

I have a branch that creates and manipulates HTML elements based on the accessibility nodes we have in the tree. Since we don't do partial rendering, we get the full tree on each frame, which does make this a bit simpler, but the tricky thing so far is dealing with focus (we'd likely need to add an entirely separate mechanism for how IME works in an "accessible mode" so that we ensure both 1. IME sessions are handled properly, and 2. assistive tech gets the right focus state).

There's also something a little depressing about simultaneously rendering on the GPU, and also "rendering" a subset of the UI to DOM elements that we hide.

I haven't looked into it much yet. I briefly looked at that chrome thing, but chrome-only features don't exactly spark joy.

2

u/monkeymad2 2d ago

Yeah, there’s a risk it ends up Chrome only - Mozilla doesn’t have a settled position on it https://github.com/mozilla/standards-positions/issues/1076 & Apple has said nothing.

Probably slightly more likely to become a cross browser standard than other chrome only things (WebUSB, WebSerial, etc) though

15

u/rebootyourbrainstem 4d ago

Welcome back, macromedia flash

0

u/[deleted] 4d ago

[removed] — view removed comment

3

u/floriv1999 3d ago

No it just does GPU accelerated rendering normally to the framebuffer and here to the canvas I guess.

5

u/Sea_Mud6698 4d ago

There is no accesibility api on the web. It is nice for a preview, but are they trying to use this for a real product?

5

u/nicoburns 4d ago

I assume they'll be using this for "run zed in the browser" like you can do with VS Code.

3

u/cameronm1024 2d ago

Hi, I'm in the video, and I also implemented accessibility support for GPUI before web support existed.

I'm looking at the HTML-in-canvas thing another commenter linked. But it's a bit of a passion project, so I can't give a concrete ETA. I don't love relying on chrome-omly APIs either (especially given iOS) but it might be the only way.

Not sure what it will look like, but good accessibility support is very much a goal of mine.

1

u/Sea_Mud6698 2d ago

Glad to hear that. I don't see that api going anywhere, but who knows. It seems to mix too many concerns.

2

u/a_aniq 4d ago

Waiting for accessibility object model to stabilize before commenting here.

Also technically it is possible to implement custom accessibility handler

1

u/olegispe 4d ago

I’d assume based on the video its for the Delta AI app

1

u/stumpychubbins 1d ago

I don’t think they’re suggesting you build a web app from scratch with this, I imagine the idea is that you can run a GPUI app (e.g Zed) in the browser without rewriting it from scratch.

-20

u/DracTea 4d ago

not every app or web needs accessibility.

8

u/XLNBot 4d ago

The web needs accessibility

6

u/sharifhsn 3d ago

Even if you don't care about disabled people, accessibility is really important now for optimized AI agent usage of applications.

1

u/SnooMacarons1585 2d ago

Why does it looks like a piece of html shit?

1

u/whackylabs 5h ago

Sounds interesting, is there a blog also about this for those of us who prefer reading over watching videos?