Skip to content

Commit 33a1af5

Browse files
fix: address Copilot review comments on PR keploy#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 74252b3 commit 33a1af5

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

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
@@ -2755,20 +2755,16 @@ img:not([loading]) {
27552755
/*
27562756
* Reduce paint layers for the announcement bar (it's a position:sticky
27572757
* element and can cause extra compositing cost on mobile).
2758+
* Using attribute substring selector to avoid relying on a hashed class name
2759+
* that changes between Docusaurus builds.
27582760
*/
2759-
.announcementBar_mb4j {
2761+
[class*="announcementBar"] {
27602762
will-change: auto;
27612763
transform: translateZ(0);
27622764
}
27632765

27642766
/*
2765-
* Font-display: swap fallback for any @font-face rules Docusaurus injects.
2766-
* This prevents invisible text during webfont load (FOIT → FOUT).
2767-
* The actual font files are already preloaded via webpack-font-preload-plugin;
2768-
* this rule is a safety net for any font loaded via a stylesheet.
2767+
* Font-display: swap is configured per @font-face declaration in
2768+
* src/fonts. Docusaurus-injected Google Fonts links already include
2769+
* &display=swap in the URL, so no additional override is needed here.
27692770
*/
2770-
@supports (font-display: swap) {
2771-
@font-face {
2772-
font-display: swap;
2773-
}
2774-
}

0 commit comments

Comments
 (0)