SSWConsulting / SSWConsulting/SSW.Website
⚡ Reduce embla-carousel forced reflow on the homepage
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 14
- Forks
- 10
- Avg merge
- 13h 51m
- Merged PRs (30d)
- 38
Description
Parent: #4889 · Priority 4 — smallest item, tackle last.
Problem
embla-carousel still appears in the forced-reflow audit:
chunks/6447.…js → ~18–26 ms
Its engine measures every slide on init:
measure: function (t) {
const { offsetTop, offsetLeft, offsetWidth, offsetHeight } = t; ...
}
The homepage mounts two carousels (v3LogoCarousel, v3PeopleCarousel), so both measure during load.
For reference, the same audit previously flagged our own ButtonRow at 21 ms; moving its geometry reads into the ResizeObserver callback removed it from the list entirely (chunk 9148 no longer appears). This issue is the remaining third-party equivalent.
Suggested approach
- Consider deferring carousel init until near-viewport.
- Caveat: naive lazy-mounting risks re-introducing layout shift (see #4890). Any deferral must reserve the carousel's height up front, otherwise we trade TBT for CLS — a bad swap, since CLS is currently the larger scoring loss.
Note
This is inside a third-party library, so the ceiling here is low. Do not start this before #4890 and #4891.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the forced-reflow audit for the homepage carousels v3LogoCarousel and v3PeopleCarousel, then inspect the embla-carousel initialization and the affected chunks. Any change is done only when the carousel no longer appears in the audit without introducing layout shift; wait until #4890 and #4891 are complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nextjs
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100