Re: [csswg-drafts] [css-contain] content-visibility: auto visibility check timing needs details (#8542)

> Well, depending on when this is defined to happen (which right now is "somewhere, somehow"), it can cause bogus `ResizeObserver` or `IntersectionObserver` notifications, for example (if we define it to happen at the regular "intersection observer" step).
> 
> It seems at the time blink does it prevents that, but it also causes other issues like scroll events not being able to see the unskipped content etc. Which is probably fine, if it is well defined.

I agree, we should elaborate on the timing in the spec

> There's also the fact that if you have two nodes, unskipping the first one might cause the second one to be unskipped as well (or skipped, but because of the remembered size shenanigans that probably doesn't matter). Seems that would still be able to cause a flash? Or various sync layout flushes, which seems rather unfortunate.

Yeah, the flashes are certainly still possible. This particular point was meant to help with the common case of c-v auto element in the viewport on load, but if those changes cause other elements to become visible, then the flash would still happen. This would be on developers to fix (better sizing etc), whereas the initial flash that we're avoiding is really hard for developers to fix.

> Those are rather significant behavior differences from a regular IntersectionObserver, if you ask me :)

This is absolutely fair. In Blink, we're using the one and the same implementation except skipping a post task which causes asynchrony. The spec also didn't mean to imply that you can or should use the javascript intersection observer for these calculations, rather that the work necessary to determine this intersection can be done by a version of an intersection observer

-- 
GitHub Notification of comment by vmpstr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8542#issuecomment-1460518797 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 8 March 2023 17:10:32 UTC