Skip to content

armgit / plexo

Public Imported from GitHub
0

Speed up downloads by combining multiple network connections in parallel

fix: focus Download instead of Not now when update dialog opens

Anmol Kapil821059ef9594
diff --git a/src/renderer/src/components/UpdateDialog.tsx b/src/renderer/src/components/UpdateDialog.tsx
index acb5116..dc37303 100644
--- a/src/renderer/src/components/UpdateDialog.tsx
+++ b/src/renderer/src/components/UpdateDialog.tsx
@@ -1,3 +1,4 @@
+import { useRef } from 'react'
import { DownloadIcon } from 'lucide-react'
import { useAppStore } from '../store/useAppStore'
import {
@@ -15,6 +16,7 @@ import { buttonVariants } from './ui/button'
export function UpdateDialog(): React.JSX.Element | null {
const availableUpdate = useAppStore((store) => store.availableUpdate)
const dismissUpdate = useAppStore((store) => store.dismissUpdate)
+ const downloadRef = useRef<HTMLAnchorElement>(null)
if (!availableUpdate) return null
@@ -25,7 +27,8 @@ export function UpdateDialog(): React.JSX.Element | null {
if (!open) dismissUpdate()
}}
>
- <AlertDialogContent>
+ {/* Focus Download, not the first button (Not now), so the primary action is the default. */}
+ <AlertDialogContent initialFocus={downloadRef}>
<AlertDialogHeader>
<AlertDialogTitle>Plexo {availableUpdate.version} is available</AlertDialogTitle>
<AlertDialogDescription>A new version is ready to download.</AlertDialogDescription>
@@ -36,7 +39,9 @@ export function UpdateDialog(): React.JSX.Element | null {
* http(s) links to the OS browser instead of opening a second app window. */}
<AlertDialogAction
className={buttonVariants({ size: 'sm' })}
- render={<a href={availableUpdate.url} target="_blank" rel="noreferrer" />}
+ render={
+ <a ref={downloadRef} href={availableUpdate.url} target="_blank" rel="noreferrer" />
+ }
>
<DownloadIcon /> Download
</AlertDialogAction>