Add optimize-scroll-stability guide#633
Conversation
|
@malchata do you think the guide should include the following which could affect scroll stability?
I guess you could think of the first as problems that arise in two-dimensional layouts. The technique Alex demonstrates is like “what to do when you need the exact intrinsic size, but can’t infer that from the content,” which could be relevant for both one and two dimension situations. |
|
I would consider an advanced use case as a "nice to have", and the more I think about it, it might be something to land after I/O. |
c36ddcf to
35c484b
Compare
Is there a workaround for this, or is the guidance effectively "make an educated guess and good luck"? Asking as someone who's given up on a I would almost rather hold off on publishing this until we have more time to smooth over these advanced use cases and rough edges with more guidance. IMO it's fine to tackle that after I/O rather than rush out a more basic version of this guide, which might trip some developers up. |
rviscomi
left a comment
There was a problem hiding this comment.
This is missing an expectations file
|
@rviscomi Unless the exact size of the contents is known ahead of time, it’s very difficult to avoid the reflow issues for two-dimensional layouts, since even for good guesses, an error has more significant effects that don’t get smoothed over as well compared to one-dimensional layouts. With that said, if you can leverage more information about the content ahead of time, like a character count, then you could improve your guesses significantly. This is a some what contrived example (since I’m using the same character to fill the items): https://knowler.dev/demos/hO9UCFj?codepen The more advanced techniques of caching the sizes after an initial layout seem a bit too tricky to include as instructions for an agent, as there could be a lot of contextual variables necessary to factor into that. There’d also be some performance tradeoffs as well. |
|
(Apologies if you got an email with a half-written version of this, I accidentally hit the keyboard shortcut and posted too soon) My high level concern is that "optimize scroll stability" is in the same vein as "improve text legibility", i.e. not a concrete use case that an agent is likely to search for. It's good guidance, but it's more useful referenced from elsewhere (i.e. like the new guide-skills) instead of expecting it to come up in a use case search. But the description already kind of hints at the actual use cases:
It just needs flipping: When we're implementing content-heavy pages (feeds, dashboards, long lists), especially lazy loaded, keeping the page layout and scrollbar stable is one of the things that improve user experience. Are there other things? Can we make a guide that's focused on the concerns that one needs to have in mind when implementing these kinds of long lazy loaded feeds? Scroll stability is only one factor. What are the others? I would suggest:
From a quick look, we also repeat guidance about how to pick a good size in performance/efficient-background-processing and in performance/defer-rendering-heavy-content:
Whereas in other places where
Demo: It's very hard to see what the demo is demonstrating. Commenting Last, there's a section at the start with reference-style docs — these shouldn't be needed, this hasn't changed recently and is not super brand new. (@rviscomi one caveat about this review is that that like I said, perf-related things are not my forte, so I can review what's here, but I'm not the right person to tell you what's missing, if anything!) |
| - `contain-intrinsic-size` is a shorthand for `contain-intrinsic-width` and `contain-intrinsic-height`. | ||
| - `contain-intrinsic-block-size` and `contain-intrinsic-inline-size` are logical variants of the longhand properties. | ||
|
|
||
| The value syntax for the longhand properties is as follows: | ||
|
|
||
| - `none` means the element has no intrinsic size for the respective dimension. | ||
| - A `<length>` value can be provided to set the intrinsic size. | ||
| - `auto <length>` can be provided to set the intrinsic size when it is unknown, otherwise, it will use the last known size of the contents while skipped for rendering. | ||
|
|
||
| The default value is `auto none` which means initially there will be no intrinsic size for the contents, but it will use the last known size once that becomes available. |
There was a problem hiding this comment.
This reads like reference documentation for contain-intrinsic-size, which the model shouldn't need (the property is Baseline Widely Available, so its syntax is well within its training data)
|
@LeaVerou Thank you for the review! I agree that including this guidance along with @rviscomi Does it seem like a good idea to defer this guide until after I/O? Perhaps before then, there could be some minor additions to the CSS skills that suggest almost always pairing |
We already have this guidance — that it was a direct quote from the CSS skill! Though it's missing the guidance about the CSS units that produce better estimates, which is great! |
Yeah let's pause this for now and pick it back up after I/O. I'll move it to draft. |
Towards #311
This adds the guide for
optimize-scroll-stabilitywhich usescontain-intrinsic-size(and friends) forcontent-visibility: auto. I went with the simplest use case as we can include more advanced ones after I/O.