The page has loaded. The work hasn’t stopped.
Forced layout, SVG rasterisation, compositor layers, offscreen rendering and interaction latency. A practical guide to the work a browser keeps doing long after WordPress has sent the HTML.
The basic principle
A website can download quickly and still feel slow when you open a menu, move through a gallery or interact with a form. After the files arrive, the browser must keep calculating positions, drawing pixels and responding to your actions. Good engineering means understanding which changes trigger that work, avoiding unnecessary repetition and giving visible interactions priority. The aim is not to remove personality or animation. It is to make the design feel effortless on the devices people actually use.
A WordPress response can be cached, compressed and delivered quickly while the interface it produces still hesitates, judders or ignores a click. Delivery performance and rendering performance are different engineering problems.
Open a menu while a carousel is moving. Expand a complicated form. Resize a page with a dozen animated illustrations. The browser now has work to do that a faster database query cannot remove. The useful question is precise: what did that interaction invalidate, and how much work must happen before the visitor sees the result?
This essay follows that work through the browser. The examples are deliberately small enough to reproduce. They are not Enjin benchmark results, and the diagrams describe architecture rather than measured timings.
A loaded page is not a finished computation
At 60Hz, successive display refreshes are approximately 16.7 milliseconds apart. At 120Hz, they are approximately 8.3 milliseconds apart. Those figures are arithmetic, not an allowance that JavaScript can consume in full: rendering, browser housekeeping and other activity also need time. A task that seems unremarkable in isolation can miss several opportunities to present a frame.
Interaction to Next Paint, or INP, concerns the latency of qualifying clicks, taps and keyboard interactions across a visit. It includes waiting before handlers run, executing those handlers, and waiting for the resulting presentation. Continuous scrolling and hovering are not themselves INP interactions. Smooth motion therefore needs its own investigation; a good interaction metric does not certify every animation. Google’s good INP threshold is 200ms or less, evaluated at the 75th percentile of page views with interactions. That is a responsiveness threshold, not a frame budget. Source: INP definition and thresholds.
For a practical WordPress review, choose actual tasks: open the navigation, advance the portfolio, validate a form, filter a directory. Record those tasks after loading has settled. A report produced by loading the homepage and immediately stopping cannot describe a later interaction it never exercised.
Follow the work, not the file extension
A useful rendering model has five stages: an update changes state; style calculation resolves applicable values; layout establishes box geometry; paint and rasterisation turn drawing instructions into pixels; compositing assembles the visible result. Browsers can omit work whose inputs remain valid. The model is explanatory, not a promise that every browser follows one identical thread sequence. Source: the browser rendering pipeline.
Moving a layout-positioned panel by changing its dimensions can affect surrounding geometry. Changing a large painted decoration can leave geometry intact but still require new pixels. An eligible animation of an already prepared layer may reuse those pixels and change how they are composed. These are different workloads even when the visible movement looks similar.
That distinction is more useful than asking whether something uses CSS or JavaScript. A declarative CSS animation can repeatedly repaint a large area. JavaScript can update a small, isolated transform. Neither implementation language is a performance certificate. Start with the visual requirement, then inspect the work required to satisfy it.
One innocent measurement can force layout
The browser normally has some freedom to batch style and layout work. A geometry read can remove that freedom. If relevant layout is dirty, asking for a current offsetWidth or bounding rectangle can require a synchronous update before JavaScript receives an answer. A geometry read is not inherently expensive; the state immediately before it matters. Chrome calls this a forced reflow and exposes attribution in its performance tooling. Source: forced reflow.
Consider independent source elements and matching decorative meters. The following functions accept an array of { source, meter } pairs. Each meter should match its source’s visual width, and changing a meter must not intentionally resize a source. Use border-box sizing on the meters so the assigned width has the intended meaning.
function syncMetersBad(pairs) {
for (const { source, meter } of pairs) {
const width = source.getBoundingClientRect().width;
meter.style.width = `${width}px`;
}
}Each write can dirty geometry before the next iteration asks for it. The same result can be expressed with two phases:
function syncMeters(pairs) {
const widths = pairs.map(({ source }) =>
source.getBoundingClientRect().width
);
pairs.forEach(({ meter }, index) => {
meter.style.width = `${widths[index]}px`;
});
}This avoids this function’s repeated write/read alternation. It does not promise zero layout: the first read may still flush earlier work, and the final writes still need processing. Nor can you rearrange a genuinely dependent algorithm arbitrarily. If a later measurement must reflect an earlier mutation, first make that dependency explicit. Sometimes CSS grid, flexbox or a shared custom property can remove the measurement altogether. Source: batching reads and writes.
In WordPress, competing components make this subtle. A form plugin can write dimensions immediately before your gallery measures them. Optimising one callback does not establish a page-wide read phase. Profile the combined interface, including third-party code and delayed widgets.
Scheduling does not make the work cheap
requestAnimationFrame() schedules a callback before a forthcoming repaint. It is one-shot, and animation progression should use elapsed time rather than assume a fixed number of callbacks per second. Putting a write/read loop inside it still permits forced layout. Scheduling and cost are separate questions. Source: requestAnimationFrame.
One useful pattern is to collapse multiple pointer events into the most recent state. This controller moves a decorative marker inside a stationary, untransformed surface. The marker is absolutely positioned at the surface’s top-left, does not affect layout, and has no conflicting transform animation.
function attachMarker(surface, marker) {
const events = new AbortController();
let frame = 0;
let latest;
surface.addEventListener('pointermove', event => {
latest = { x: event.clientX, y: event.clientY };
if (frame) return;
frame = requestAnimationFrame(() => {
frame = 0;
const box = surface.getBoundingClientRect();
const x = latest.x - box.left - surface.clientLeft;
const y = latest.y - box.top - surface.clientTop;
marker.style.transform = `translate(${x}px, ${y}px)`;
});
}, { signal: events.signal });
return () => {
events.abort();
cancelAnimationFrame(frame);
};
}The surface must not scroll internally; scaled or rotated surfaces require coordinate conversion beyond this example. We have bounded the pending visual callbacks and supplied teardown, rather than claiming the geometry read is free. A gallery rebuilt after an AJAX response should dispose of the old controller before attaching a new one.
For long computational tasks, moving everything into a frame callback is the wrong response. Break suitable work into chunks, or move independent computation to a worker. Where supported, scheduler.yield() lets an asynchronous task yield to the browser; it needs feature detection and an appropriate fallback. await Promise.resolve() merely adds a microtask and does not provide the same opportunity for input and rendering. Yielding also introduces interleaving: handle cancellation and superseded results. Source: scheduler.yield.
Compositing is an opportunity, not a magic word
Transforms and opacity are useful candidates for animation because browsers can often handle them without repeating layout and paint. Eligibility depends on the element, effects, browser and surrounding scene. Changing transform from a main-thread callback still requires that callback to run; it is different from an animation the compositor can advance independently. Check the recording rather than infer the path from a property name.
Layer promotion also has a cost. As a simple storage illustration, a 1024 × 1024 CSS-pixel surface at device-pixel-ratio 2 contains 2048 × 2048 device pixels. At four bytes per pixel that is 16MiB for one uncompressed buffer. This is not a measurement of a real browser layer: tiling, clipping, buffer reuse, formats and implementation overhead change actual allocation. It does explain why promoting many large surfaces can trade one bottleneck for another.
will-change is a hint, not an instruction to manufacture unlimited acceleration. It can consume resources and alter stacking behaviour. Use it only where a trace shows a benefit, give the browser preparation time, and remove temporary hints when the interaction finishes. Avoid declaring it on every card just because cards might be hovered. Source: will-change trade-offs.
A large translucent fixed overlay, a blur filter and a deep stack of promoted descendants deserve particular attention. Paint flashing, layer borders and the performance trace answer different questions; a quiet paint overlay does not prove that GPU work or memory pressure is negligible. Source: rendering diagnostics.
SVG is scalable. Its rendering cost is not zero
An SVG file describes shapes. A screen still needs pixels. Rotating an entire prepared illustration and changing its path geometry on every frame can create very different workloads. Filters, masks, strokes and the size of the affected region matter as much as transfer size. An eight-kilobyte illustration is not necessarily cheap to redraw.
For a simple rotating instrument, give the moving part a dedicated group. Keep static labels and guidework outside it. Explicitly define the coordinate reference for CSS transforms:
.instrument-rotor {
transform-box: fill-box;
transform-origin: center;
animation: instrument-turn 36s linear infinite;
}
@keyframes instrument-turn {
to { transform: rotate(1turn); }
}fill-box makes the element’s object bounding box the reference box; view-box uses the SVG viewport’s coordinate system. Those choices produce different centres. Do not assume an SVG group behaves like an ordinary HTML box, and do not infer compositor eligibility from this snippet. Source: SVG transform reference boxes.
Animated stroke dashes are a legitimate design tool, but they are not equivalent to moving a cached layer. A small, bounded repaint may be an entirely reasonable trade-off. The engineering decision concerns the amount of work, how long it continues, and its effect alongside the rest of the page.
Scaling can also expose rasterisation decisions. A browser may reuse or regenerate intermediate surfaces at different scales; an SVG containing an embedded bitmap cannot invent additional bitmap detail. If an animation looks temporarily soft, first inspect the asset, its CSS size, transform scale and device pixel ratio. A blur during zoom is not, by itself, proof of lazy loading. Reproduce it in the affected browser before adding promotion hacks.
Containment changes the component contract
CSS containment lets a component declare boundaries around aspects of its rendering. contain: layout paint can help isolate work, but paint containment clips descendants at the containment boundary and layout containment changes positioning behaviour. It is unsuitable as an indiscriminate rule for every section: a dropdown, focus outline or tooltip may need to escape. Size containment has additional consequences because descendants no longer determine the contained size in the usual way. Source: containment semantics.
For substantial below-the-fold sections, consider a different experiment:
@supports (content-visibility: auto) {
.deferred-section {
content-visibility: auto;
contain-intrinsic-block-size: auto 48rem;
}
}content-visibility: auto allows the browser to skip rendering work for content that is not relevant to the user. The content remains in the document and should remain available to features such as find-in-page and keyboard navigation. It is not lazy loading for HTML, images or JavaScript, and it does not automatically stop your own timers. Source: content-visibility.
The auto 48rem intrinsic block size supplies an initial estimate and can use a remembered rendered size later. Pick the estimate from the component’s actual content pattern, not from this illustrative value. A poor estimate can disturb scroll position as real content replaces the placeholder. Test anchor navigation, sticky elements, focus, browser search and expansion states before applying the rule across an ACF layout system. Source: intrinsic block sizing.
Give decorative motion a lifecycle
Hiding or clipping an element is not a complete lifecycle policy. A component needs decisions about when to start, pause, resume and dispose. Intersection Observer supplies asynchronous intersection information without an application polling every element’s geometry on every scroll event. It does not guarantee that the element is unobscured or that every pixel is visible. Source: Intersection Observer.
This example uses a dedicated HTML rotor inside a decorative instrument. Its baseline transform is neutral. Motion runs only while the instrument intersects the viewport, the document is visible and reduced motion is not requested. It uses the Web Animations API, so do not also apply the earlier CSS animation to this same rotor.
function attachInstrument(instrument) {
const rotor = instrument.querySelector('.rotor');
if (!rotor) return () => {};
const events = new AbortController();
const reduced = matchMedia('(prefers-reduced-motion: reduce)');
const motion = rotor.animate(
[{ transform: 'rotate(0deg)' }, { transform: 'rotate(360deg)' }],
{ duration: 36000, iterations: Infinity }
);
motion.pause();
let visible = !('IntersectionObserver' in window);
const sync = () => {
if (visible && !document.hidden && !reduced.matches) motion.play();
else motion.pause();
};
const observer = 'IntersectionObserver' in window
? new IntersectionObserver(entries => {
visible = entries[entries.length - 1].isIntersecting;
sync();
})
: null;
observer?.observe(instrument);
document.addEventListener('visibilitychange', sync,
{ signal: events.signal });
reduced.addEventListener('change', sync, { signal: events.signal });
sync();
return () => {
observer?.disconnect();
events.abort();
motion.cancel();
};
}The fallback keeps the illustration usable without Intersection Observer. A reduced-motion change pauses at the current orientation; choose a reset-to-start policy if the artwork needs one. For components inserted dynamically, attach once and invoke the returned disposer when removing them. A larger page can share one observer rather than create one per illustration. Source: Web Animations API.
Measure the interaction you are trying to improve
Start with a reproducible sequence and a named hypothesis. For example: “opening this filter panel repeatedly reads dirty geometry”, or “this SVG filter repaints most of the viewport”. A faster-looking screenshot is not evidence of either claim.
- Record the browser version, viewport, device pixel ratio and the device or CPU-throttling configuration. Use the same interaction and content in both runs.
- Capture a short Performance recording around the action. Inspect scripting, style/layout, painting and frame presentation, rather than only the total task duration.
- Use call stacks or forced-reflow attribution to connect expensive work to the component responsible. A plugin filename is a starting point, not a diagnosis.
- Change one relevant mechanism, repeat the action and compare several runs. Report the workload and variability if publishing measurements.
Chrome’s Performance panel supports this investigation; its controls and terminology can change between browser versions. Repeat the important behaviours on actual target devices and other engines. CPU throttling is useful for controlled comparisons but is not a complete simulation of another device’s GPU, memory or thermal behaviour. Source: Performance panel reference.
User Timing marks are useful for delimiting your own work:
performance.mark('meters:start');
syncMeters(pairs);
performance.mark('meters:end');
performance.measure('meters:read-and-write', 'meters:start', 'meters:end');This measurement includes synchronous work completed inside the function, including a layout flush if one occurred there. It does not measure the eventual presentation of its DOM writes. Calling the result “render time” would overstate what was measured. Clear or bound diagnostic entries in long-running production sessions. Source: Performance.measure.
Where supported, Long Animation Frame entries provide another diagnostic view:
function observeLongFrames() {
if (!globalThis.PerformanceObserver?.supportedEntryTypes
.includes('long-animation-frame')) return () => {};
const samples = [];
const observer = new PerformanceObserver(list => {
for (const entry of list.getEntries()) {
samples.push({
duration: entry.duration,
blockingDuration: entry.blockingDuration,
forcedLayout: entry.scripts.reduce((total, script) =>
total + script.forcedStyleAndLayoutDuration, 0)
});
}
if (samples.length > 20) samples.splice(0, samples.length - 20);
console.table(samples);
});
observer.observe({ type: 'long-animation-frame', buffered: true });
return () => observer.disconnect();
}These entries concern frames exceeding 50ms; many missed 60Hz or 120Hz frame deadlines are shorter than that. Script attribution has limits, and this API is not supported by every browser. An empty log is therefore not proof of smoothness. Keep diagnostic logging out of the normal production path unless you have an intentional sampling and data policy. Source: long animation frame timing.
Bring the discipline back into WordPress
WordPress determines much of the work the browser receives: the depth and repetition of markup, how components are composed, which stylesheets are required, and which controllers start on a page. An ACF section should have an explicit rendering and behaviour contract. A decorative illustration should not silently install document-wide listeners every time a flexible-content row renders.
Load a controller only where its component exists, initialise each instance once and provide teardown where the page can replace content. WordPress’s enqueue system manages dependencies and loading strategies; defer changes script scheduling, not the cost of its eventual execution. A deferred controller that monopolises the main thread can still damage responsiveness. Source: WordPress script enqueueing.
The same reasoning applies to CSS. Keep behaviour in shared component classes. Use ACF to select meaningful layout or motion variants, rather than injecting escalating page-specific overrides. For a carousel, decide whether offscreen items remain rendered, whether motion pauses, and what happens when a visitor re-enters it. For a form, test the actual validation and conditional-field transitions. For a menu, test opening while the page is busy, not just on an idle desktop.
Our essay on content-aware JavaScript and CSS covers deciding which assets a page earns. This is the next part of that contract: once those assets arrive, what work are they allowed to create? The browser does not reward a small bundle for repeatedly asking it to do expensive things.
A distinctive interface can be a disciplined one. Keep the motion that communicates something, bound its cost and stop unnecessary work. Then use a trace to establish whether the engineering decision delivered the experience you intended.
Code examples illustrate the architecture and identify application-specific interfaces. Adapt them to your environment and test the failure paths before deployment. Sources are linked alongside the relevant discussion.