Skip to content

Commit 3d2070b

Browse files
committed
Fixing progress bar not resetting
1 parent 1fec7a4 commit 3d2070b

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

content.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@
7373
transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
7474
}
7575

76+
/* Disable transition helper class (used during reset to prevent reverse animation) */
77+
#license-diff-progress.no-transition {
78+
transition: none !important;
79+
}
80+
7681
/* Create a separate class for the animated state */
7782
#license-diff-progress.animating {
7883
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%,

content.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,17 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
103103
document.getElementById('license-diff-url').innerHTML = '';
104104
document.getElementById('license-diff-display').innerHTML = '';
105105

106-
const progressBar = document.getElementById('license-diff-progress');
107-
progressBar.style.width = '0%';
108-
progressBar.classList.add('animating'); // Start animation
109-
106+
const progressBar = document.getElementById('license-diff-progress');
107+
// Reset progress
108+
progressBar.classList.remove('animating');
109+
progressBar.classList.add('no-transition');
110+
progressBar.style.width = '0%';
111+
// Force reflow so the browser applies width without transition
112+
void progressBar.offsetWidth;
113+
progressBar.classList.remove('no-transition');
114+
110115
document.getElementById('license-diff-status').innerText = 'Starting license comparison...';
111-
116+
112117
// Reset the global matches array
113118
matches = [];
114119

@@ -119,7 +124,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
119124
const progressBar = document.getElementById('license-diff-progress');
120125

121126
// Add animation class if not already there
122-
if (!progressBar.classList.contains('animating')) {
127+
if (!progressBar.classList.contains('animating') && progressPercent > 0) {
123128
progressBar.classList.add('animating');
124129
}
125130

0 commit comments

Comments
 (0)