lazy-loading done
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
## MODIFIED Requirements
|
||||
|
||||
### Requirement: Standard card information architecture
|
||||
All content cards rendered by the site MUST use a standardized layout so cards across different surfaces look consistent.
|
||||
|
||||
The standard card layout MUST be:
|
||||
- featured image displayed prominently at the top (when available), with a shimmer placeholder visible while the image loads
|
||||
- title
|
||||
- summary/excerpt text, trimmed to a fixed maximum length
|
||||
- footer row showing:
|
||||
- publish date on the left
|
||||
- views when available (if omitted, the footer MUST still render cleanly)
|
||||
- the content source label (e.g., `youtube`, `podcast`, `blog`)
|
||||
|
||||
If a field is not available (for example, views for some sources), the card MUST still render cleanly with that field omitted.
|
||||
|
||||
#### Scenario: Card renders with all fields
|
||||
- **WHEN** a content item has an image, title, summary, publish date, views, and source
|
||||
- **THEN** the card renders those fields in the standard card layout order
|
||||
|
||||
#### Scenario: Card renders without views
|
||||
- **WHEN** a content item has no views data
|
||||
- **THEN** the card renders the footer bar with date + source and omits views without breaking the layout
|
||||
|
||||
#### Scenario: Card renders without featured image
|
||||
- **WHEN** a content item has no featured image
|
||||
- **THEN** the card renders a placeholder media area and still renders the remaining fields
|
||||
|
||||
#### Scenario: Card image shows shimmer while loading
|
||||
- **WHEN** a content item has an image URL and the image has not yet loaded
|
||||
- **THEN** the card media area displays an animated shimmer placeholder until the image loads and fades in
|
||||
|
||||
#### Scenario: Card image load failure shows static placeholder
|
||||
- **WHEN** a content item has an image URL but the image fails to load
|
||||
- **THEN** the card media area displays a static placeholder (no broken image icon) and the card remains visually intact
|
||||
@@ -0,0 +1,50 @@
|
||||
## ADDED Requirements
|
||||
|
||||
### Requirement: Shimmer placeholder while images load
|
||||
Every site image that uses `loading="lazy"` MUST display an animated shimmer placeholder in its container while the image is downloading.
|
||||
|
||||
The shimmer MUST be a translucent gradient sweep animation that matches the site's dark theme.
|
||||
|
||||
The shimmer MUST be visible from the moment the page renders until the image finishes loading.
|
||||
|
||||
#### Scenario: Image loads successfully on slow connection
|
||||
- **WHEN** a page renders with a lazy-loaded image and the image takes time to download
|
||||
- **THEN** the image container displays an animated shimmer placeholder until the image finishes loading
|
||||
|
||||
#### Scenario: Image loads from browser cache
|
||||
- **WHEN** a page renders with a lazy-loaded image that is already in the browser cache
|
||||
- **THEN** the image displays immediately with no visible shimmer flicker
|
||||
|
||||
### Requirement: Fade-in transition on image load
|
||||
When a lazy-loaded image finishes downloading, it MUST fade in smoothly over the shimmer placeholder using a CSS opacity transition.
|
||||
|
||||
The fade-in duration MUST be short enough to feel responsive (no longer than 300ms).
|
||||
|
||||
#### Scenario: Image completes loading
|
||||
- **WHEN** a lazy-loaded image finishes downloading
|
||||
- **THEN** the image fades in over approximately 200–300ms, replacing the shimmer placeholder
|
||||
|
||||
### Requirement: Graceful degradation on image load failure
|
||||
If a lazy-loaded image fails to load (network error, 404, etc.), the shimmer animation MUST stop and the placeholder MUST remain visible as a static block.
|
||||
|
||||
The page MUST NOT display a broken image icon.
|
||||
|
||||
#### Scenario: Image fails to load
|
||||
- **WHEN** a lazy-loaded image triggers an error event (e.g., 404 or network failure)
|
||||
- **THEN** the shimmer animation stops and the container displays a static placeholder background instead of a broken image icon
|
||||
|
||||
### Requirement: Reduced motion support for shimmer
|
||||
The shimmer animation MUST be suppressed when the user has `prefers-reduced-motion: reduce` enabled.
|
||||
|
||||
When motion is reduced, the placeholder MUST still be visible as a static block (no animation), maintaining the loading indicator without motion.
|
||||
|
||||
#### Scenario: User has reduced motion enabled
|
||||
- **WHEN** a user with `prefers-reduced-motion: reduce` views a page with lazy-loaded images
|
||||
- **THEN** the placeholder is visible as a static block without any sweeping animation
|
||||
|
||||
### Requirement: No layout shift from shimmer
|
||||
The shimmer placeholder MUST NOT cause any cumulative layout shift (CLS). The placeholder MUST occupy the exact same dimensions as the image it replaces.
|
||||
|
||||
#### Scenario: Placeholder matches image dimensions
|
||||
- **WHEN** a page renders with a shimmer placeholder for a card thumbnail
|
||||
- **THEN** the placeholder occupies the same width and height as the image area (e.g., 100% width × 180px height for card thumbnails) with no layout shift when the image loads
|
||||
Reference in New Issue
Block a user