refactor(download): rename locationStep id to downloadLocationStep

The download modal's step shared the 'locationStep' id with the import
modal, so getElementById('locationStep') could resolve to the wrong
element depending on template include order. The import flow relied on
an injected display:block !important rule to work around it.

Rename the download modal's step id and update all references so each
modal owns a unique step id.
This commit is contained in:
Will Miao
2026-08-08 08:50:36 +08:00
parent c5088772e8
commit 4bf9a4b640
4 changed files with 7 additions and 10 deletions

View File

@@ -754,7 +754,7 @@ export class DownloadManager {
this.selectedFile?.id, this.selectedFile?.name, this.selectedFile?.type, this.selectedFile?.metadata);
document.getElementById('fileSelectionStep').style.display = 'none';
document.getElementById('locationStep').style.display = 'block';
document.getElementById('downloadLocationStep').style.display = 'block';
this.proceedToLocationContent();
}
@@ -788,7 +788,7 @@ export class DownloadManager {
}
document.querySelectorAll('.download-step').forEach(step => step.style.display = 'none');
document.getElementById('locationStep').style.display = 'block';
document.getElementById('downloadLocationStep').style.display = 'block';
await this.proceedToLocationContent();
}
@@ -1563,7 +1563,7 @@ export class DownloadManager {
}
backToVersions() {
document.getElementById('locationStep').style.display = 'none';
document.getElementById('downloadLocationStep').style.display = 'none';
if (this.isBatchMode) {
document.getElementById('batchPreviewStep').style.display = 'block';
} else {

View File

@@ -47,11 +47,8 @@ export class ImportStepManager {
targetStep.offsetHeight;
}
// Reset scroll via class: 'locationStep' has a duplicate ID in downloadModal's
// template, so getElementById may not return the import modal's step.
document.querySelectorAll('.import-step').forEach(step => {
step.scrollTop = 0;
});
// Scroll the active step back to top (steps scroll independently of the modal shell)
targetStep.scrollTop = 0;
}
}
}

View File

@@ -60,7 +60,7 @@
</div>
<!-- Step 3: Location Selection -->
<div class="download-step" id="locationStep" style="display: none;">
<div class="download-step" id="downloadLocationStep" style="display: none;">
<div class="location-selection">
<!-- Path preview with inline toggle -->
<div class="path-preview">

View File

@@ -118,7 +118,7 @@ function setupDownloadDom() {
<div class="download-step" id="urlStep"></div>
<div class="download-step" id="versionStep"></div>
<div class="download-step" id="fileSelectionStep"></div>
<div class="download-step" id="locationStep"></div>
<div class="download-step" id="downloadLocationStep"></div>
<div id="batchPreviewStep"></div>
<textarea id="modelUrl"></textarea>
<div id="urlError"></div>