Skip to content

Commit 7326885

Browse files
authored
Progress bar label script refactor (#76)
* JS: rename textWidth variable to barWithOverflowWidth * JS: use clientWidth instead of offsetWidth It's seems better since we don't use padding attribute, and scrollWidth wouldn't include it anyway.
1 parent 456a081 commit 7326885

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

template.html.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@
5555
<script>
5656
function updateProgressBarVisibility() {
5757
document.querySelectorAll('.progress-bar').forEach(progressBar => {
58-
const textWidth = progressBar.scrollWidth;
59-
const barWidth = progressBar.offsetWidth;
58+
const barWithOverflowWidth = progressBar.scrollWidth;
59+
const barWidth = progressBar.clientWidth;
6060
61-
if (barWidth < textWidth) {
61+
if (barWidth < barWithOverflowWidth) {
6262
progressBar.classList.add('low');
6363
} else {
6464
progressBar.classList.remove('low');

0 commit comments

Comments
 (0)