Skip to content

Commit b8ceaa7

Browse files
fix: address Copilot review comments on PR #795
- css: replace hashed .announcementBar_mb4j selector with [class*=announcementBar] to survive Docusaurus rebuilds - css: remove invalid empty @font-face block; a @font-face without font-family/src has no effect in any browser - ResponsivePlayer: add visible spinner + role=status to Suspense fallback for better UX on slow connections - netlify.toml: change /fonts/* from immutable to 1-week cache since font files (Roboto-Bold.woff2 etc.) are not content-hashed Signed-off-by: Aryan Parikh <aryan81006@gmail.com>
1 parent aa94da4 commit b8ceaa7

3 files changed

Lines changed: 15 additions & 13 deletions

File tree

netlify.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@
1616
[headers.values]
1717
Cache-Control = "public, max-age=31536000, immutable"
1818

19-
# Static images, fonts served from /img and /fonts
19+
# Static images served from /img
2020
[[headers]]
2121
for = "/img/*"
2222
[headers.values]
2323
Cache-Control = "public, max-age=86400, stale-while-revalidate=604800"
2424

25+
# Fonts are NOT content-hashed (e.g. Roboto-Bold.woff2) so immutable is unsafe.
26+
# Use a 1-week cache with stale-while-revalidate instead.
2527
[[headers]]
2628
for = "/fonts/*"
2729
[headers.values]
28-
Cache-Control = "public, max-age=31536000, immutable"
30+
Cache-Control = "public, max-age=604800, stale-while-revalidate=86400"
2931

3032
# Static JS helpers (non-hashed scripts in /docs/js and /docs/scripts)
3133
[[headers]]

src/components/responsive-player/ResponsivePlayer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ function ResponsivePlayer({url, loop, playing}) {
1616
fallback={
1717
<div
1818
className="absolute left-0 top-0 flex h-full w-full items-center justify-center bg-gray-100 dark:bg-gray-800"
19+
role="status"
1920
aria-label="Loading video player"
20-
/>
21+
>
22+
<div className="h-8 w-8 animate-spin rounded-full border-2 border-gray-400 border-t-transparent dark:border-gray-500" />
23+
<span className="sr-only">Loading video player</span>
24+
</div>
2125
}
2226
>
2327
<ReactPlayer

src/css/custom.css

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,20 +3236,16 @@ img:not([loading]) {
32363236
/*
32373237
* Reduce paint layers for the announcement bar (it's a position:sticky
32383238
* element and can cause extra compositing cost on mobile).
3239+
* Using attribute substring selector to avoid relying on a hashed class name
3240+
* that changes between Docusaurus builds.
32393241
*/
3240-
.announcementBar_mb4j {
3242+
[class*="announcementBar"] {
32413243
will-change: auto;
32423244
transform: translateZ(0);
32433245
}
32443246

32453247
/*
3246-
* Font-display: swap fallback for any @font-face rules Docusaurus injects.
3247-
* This prevents invisible text during webfont load (FOIT → FOUT).
3248-
* The actual font files are already preloaded via webpack-font-preload-plugin;
3249-
* this rule is a safety net for any font loaded via a stylesheet.
3248+
* Font-display: swap is configured per @font-face declaration in
3249+
* src/fonts. Docusaurus-injected Google Fonts links already include
3250+
* &display=swap in the URL, so no additional override is needed here.
32503251
*/
3251-
@supports (font-display: swap) {
3252-
@font-face {
3253-
font-display: swap;
3254-
}
3255-
}

0 commit comments

Comments
 (0)