-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix: check Linux platform before macOS in user agent detection #2860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -377,10 +377,10 @@ const mobileEndorsementRows = [ | |
| function detectPlatform(): Platform | null { | ||
| const ua = navigator.userAgent; | ||
| if (/Win/i.test(ua)) return { os: "win", label: "Download for Windows" }; | ||
| if (/Linux/i.test(ua)) return { os: "linux", label: "Download for Linux" }; | ||
| if (/Mac/i.test(ua)) { | ||
| return { os: "mac", label: "Download for macOS", arch: "arm64" }; | ||
| } | ||
| if (/Linux/i.test(ua)) return { os: "linux", label: "Download for Linux" }; | ||
| return null; | ||
| } | ||
|
|
||
|
|
@@ -548,7 +548,6 @@ const mobileEndorsementRows = [ | |
| :global([data-platform="mac"]) .dl-icon--apple { display: block; } | ||
| :global([data-platform="win"]) .dl-icon--windows { display: block; } | ||
| :global([data-platform="linux"]) .dl-icon--linux { display: block; } | ||
| :global(:not([data-platform])) .dl-icon--apple { display: block; } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed CSS fallback leaves default state without iconMedium Severity The Reviewed by Cursor Bugbot for commit 7a1b209. Configure here. |
||
|
|
||
| /* Floating harness marks */ | ||
| .hero-float { | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium
pages/index.astro:548The removed CSS fallback
:global(:not([data-platform])) .dl-icon--apple { display: block; }causes the download buttons to show the hardcoded macOS label text with no icon during page load (before JS runs) or permanently for unrecognized user agents. The icon only appears afterdetectPlatform()executes and setsdata-platform, creating a flash of unstyled content for all users.:global([data-platform="mac"]) .dl-icon--apple { display: block; } :global([data-platform="win"]) .dl-icon--windows { display: block; } :global([data-platform="linux"]) .dl-icon--linux { display: block; } + :global(:not([data-platform])) .dl-icon--apple { display: block; }🤖 Copy this AI Prompt to have your agent fix this: