Enhance download modals: auto-focus on URL input and auto-select version if only one available

This commit is contained in:
Will Miao
2025-05-22 11:07:52 +08:00
parent b25fbd6e24
commit b9c9d602de
2 changed files with 26 additions and 0 deletions

View File

@@ -36,6 +36,14 @@ export class CheckpointDownloadManager {
this.cleanupFolderBrowser();
});
this.resetSteps();
// Auto-focus on the URL input
setTimeout(() => {
const urlInput = document.getElementById('checkpointUrl');
if (urlInput) {
urlInput.focus();
}
}, 100); // Small delay to ensure the modal is fully displayed
}
resetSteps() {
@@ -178,6 +186,11 @@ export class CheckpointDownloadManager {
`;
}).join('');
// Auto-select the version if there's only one
if (this.versions.length === 1 && !this.currentVersion) {
this.selectVersion(this.versions[0].id.toString());
}
// Update Next button state based on initial selection
this.updateNextButtonState();
}

View File

@@ -38,6 +38,14 @@ export class DownloadManager {
this.cleanupFolderBrowser();
});
this.resetSteps();
// Auto-focus on the URL input
setTimeout(() => {
const urlInput = document.getElementById('loraUrl');
if (urlInput) {
urlInput.focus();
}
}, 100); // Small delay to ensure the modal is fully displayed
}
resetSteps() {
@@ -182,6 +190,11 @@ export class DownloadManager {
`;
}).join('');
// Auto-select the version if there's only one
if (this.versions.length === 1 && !this.currentVersion) {
this.selectVersion(this.versions[0].id.toString());
}
// Update Next button state based on initial selection
this.updateNextButtonState();
}