Skip to content

Commit 7a9526b

Browse files
fix: tile scroll works when coverage section has no detail list (100% state)
1 parent 9a8a1db commit 7a9526b

File tree

2 files changed

+22
-0
lines changed
  • dashboard-site/scripts
  • src/Spectra.CLI/Dashboard/Templates/scripts

2 files changed

+22
-0
lines changed

dashboard-site/scripts/app.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,17 @@ function scrollToCoverageSection(sectionId) {
14761476
toggleCoverageDetails(sectionId);
14771477
}
14781478
section.scrollIntoView({ behavior: 'smooth', block: 'start' });
1479+
return;
1480+
}
1481+
// Fallback: no detail list (e.g. 100% coverage shows success state).
1482+
// Find the section by matching the label text.
1483+
const allSections = document.querySelectorAll('.coverage-section');
1484+
for (const sec of allSections) {
1485+
const label = sec.querySelector('.coverage-section-label');
1486+
if (label && label.textContent.toLowerCase().replace(/\s+/g, '-') === sectionId) {
1487+
sec.scrollIntoView({ behavior: 'smooth', block: 'start' });
1488+
return;
1489+
}
14791490
}
14801491
}
14811492

src/Spectra.CLI/Dashboard/Templates/scripts/app.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,17 @@ function scrollToCoverageSection(sectionId) {
14761476
toggleCoverageDetails(sectionId);
14771477
}
14781478
section.scrollIntoView({ behavior: 'smooth', block: 'start' });
1479+
return;
1480+
}
1481+
// Fallback: no detail list (e.g. 100% coverage shows success state).
1482+
// Find the section by matching the label text.
1483+
const allSections = document.querySelectorAll('.coverage-section');
1484+
for (const sec of allSections) {
1485+
const label = sec.querySelector('.coverage-section-label');
1486+
if (label && label.textContent.toLowerCase().replace(/\s+/g, '-') === sectionId) {
1487+
sec.scrollIntoView({ behavior: 'smooth', block: 'start' });
1488+
return;
1489+
}
14791490
}
14801491
}
14811492

0 commit comments

Comments
 (0)