Anyone had to deal with layout shift from CMS cont...
# suitecommerce
c
Anyone had to deal with layout shift from CMS content loading? Wondering if you came up with an approach that works for a site that rotates CMS content every few days.
k
@Chris Is this related to Google CLS measurements? One of our clients asked us to resolve a similar issue. In their case, they had content in the footer template that was appearing prior to CMS content loading on the Home page. When the CMS content was loaded, it shifted the footer content. I was wondering if you could fix this issue with hiding <div> tags below the CMS content using CSS then once the CMS content is loaded, display the <div> tags. I never tested it to see if Google CLS measurement improved.
c
We're gonna try assigning a min-height to the CMS content div to keep the layout from expanding in a jerky fashion once the cms service returns. Hopefully this will cut the offending CLS measurement by providing a "soft landing" place for the loaded html. I think it'll help because the footer will get pushed off the bottom of the page so it never has to shift.
☝🏻 1
k
Let me know how it works out. This could be huge for reducing CLS measurement.
c
Going to prod tomorrow. Works really well in sandbox. I'll update thread when I know more.
s
If you know the height of an element that will load in content later, the standard practice is to explicitly set the height of that element beforehand.
c
@Steve Goldberg Is there a way to coax CMS content to cache?
It's possible that I'm overlooking something readily available.
s
AFAIK it should already be cached
c
message has been deleted
s
What type of content?
c
CMS_HTML
s
Hmm. I've not troubleshooted that kind of caching problem before so I can't really give you advice
✔️ 1
c
@Keith Fetterman CLS measurement decreased dramatically with some careful addition of min-height for expected content size. So it does work.