Makes the first render match the prerendered HTML
Search values, the 404 buttons and the footer year now apply after hydration. The e-mail address stays out of the HTML behind a placeholder, and all review texts are in the page, so crawlers can read them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { lazy, Suspense } from 'react';
|
||||
import { Box } from '@chakra-ui/react';
|
||||
import { Box, VisuallyHidden } from '@chakra-ui/react';
|
||||
import { DEFERRED_LOAD_MARGIN } from '@/components/DeferredImage/DeferredImage';
|
||||
import PageSection from '@/components/PageSection/PageSection';
|
||||
import Reveal from '@/components/Reveal/Reveal';
|
||||
@@ -71,7 +71,10 @@ export default function Testimonials({
|
||||
// out exactly like a slide (same padding), plus the controls' height. That
|
||||
// makes it as tall as the carousel at every screen width, so nothing below
|
||||
// moves when the carousel takes its place, not even during a scroll to
|
||||
// #contact that passes this section while it loads.
|
||||
// #contact that passes this section while it loads. The other reviews are in
|
||||
// the page too, visually hidden, so the prerendered HTML holds every review
|
||||
// text for search engines (BR-LZY-02). They are aria-hidden and inert, so
|
||||
// assistive technology reads each review once, in the carousel.
|
||||
function CarouselPlaceholder({
|
||||
testimonials,
|
||||
}: {
|
||||
@@ -85,6 +88,15 @@ function CarouselPlaceholder({
|
||||
<Box ps={{ base: 0, sm: '1.5rem' }} pb={{ base: 0, sm: '1.5rem' }}>
|
||||
<TestimonialSlide testimonial={longest} />
|
||||
</Box>
|
||||
{testimonials
|
||||
.filter((testimonial) => testimonial !== longest)
|
||||
.map((testimonial) => (
|
||||
<VisuallyHidden key={testimonial.id} asChild>
|
||||
<Box aria-hidden="true" inert>
|
||||
<TestimonialSlide testimonial={testimonial} />
|
||||
</Box>
|
||||
</VisuallyHidden>
|
||||
))}
|
||||
{/* The control bar: 48px buttons below the same margin */}
|
||||
<Box mt="clamp(2.5rem, 5vw, 4rem)" h="48px" />
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user