whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
7.9k stars 2.58k forks source link

Consider upgrading ARIA reflection from FrozenArray<> to ObservableArray<> #10246

Open domenic opened 3 months ago

domenic commented 3 months ago

What is the issue with the HTML Standard?

Given discussions like https://github.com/whatwg/html/issues/10219 and the general problems with mutable FrozenArray<> attributes (see https://github.com/whatwg/webidl/issues/810), I was considering whether we could upgrade to ObservableArray<>. It has some advantages:

I think this would look something like the following:

Possible issue: in this version, the backing list holds strong references to the elements. I'm not sure exactly what problems that creates.

Possible issue: at least in the spec, we need to monitor for changes to id=""s, instead of computing lazily. Assuming implementations have a per-spec implementation of FrozenArray<>, this is probably an extra cost. Optimization is definitely possible in a variety of ways, but it's more code to write.


I'm not sure there's any implementer appetite for continuing to churn in this space. But I thought I'd mention it and write down the above sketch. /cc @annevk @alice @petervanderbeken.

annevk commented 3 months ago

I think we already have the problem of strong references due to FrozenArray holding strong references. In https://github.com/whatwg/html/issues/8545 @smaug---- felt most strongly about fixing this, but since then Gecko might also have shipped this "leak" or is about to?

As for the overall ask: I suspect WebKit would be okay with aligning here, but not necessarily willing to lead the charge.

cc @rniwa