You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adev/src/content/guide/templates/defer.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -360,3 +360,26 @@ When you have nested `@defer` blocks, they should have different triggers in ord
360
360
Avoid deferring components that are visible in the user’s viewport on initial load. Doing this may negatively affect Core Web Vitals by causing an increase in cumulative layout shift (CLS).
361
361
362
362
In the event this is necessary, avoid`immediate`,`timer`,`viewport`, and custom`when` triggers that cause the content to load during the initial page render.
363
+
364
+
###Keep accessibility in mind
365
+
366
+
When using`@defer` blocks, consider the impact on users with assistive technologies like screen readers.
367
+
Screen readers that focus on a deferred section will initially read the placeholder or loading content, but may not announce changes when the deferred content loads.
368
+
369
+
To ensure deferred content changes are announced to screen readers, you can wrap your`@defer` block in an element with a live region:
370
+
371
+
```angular-html
372
+
<div aria-live="polite" aria-atomic="true">
373
+
@defer (on timer(2000)) {
374
+
<user-profile [user]="currentUser" />
375
+
} @placeholder {
376
+
Loading user profile...
377
+
} @loading {
378
+
Please wait...
379
+
} @error {
380
+
Failed to load profile
381
+
}
382
+
</div>
383
+
```
384
+
385
+
This ensures that changes are announced to the user when transitions (placeholder→ loading→ content/error) occur.