fix: replace back-to-top button icon with SVG for improved accessibility and styling

This commit is contained in:
interlope committed 2026-06-01 23:33:07 +02:00
1 parent a3099cad03
commit 1349d3b3dc
2 files changed
+9 -14

No files matched your search

+6 -13
View File
@@ -1606,10 +1606,8 @@ footer.footer-modern a:hover {
border-radius: 50%; border-radius: 50%;
background: var(--accent); background: var(--accent);
color: var(--accent-contrast); color: var(--accent-contrast);
font-size: 1.25rem; display: grid;
display: flex; place-items: center;
align-items: center;
justify-content: center;
cursor: pointer; cursor: pointer;
box-shadow: var(--shadow-md); box-shadow: var(--shadow-md);
opacity: 0; opacity: 0;
@@ -1629,15 +1627,10 @@ footer.footer-modern a:hover {
background: var(--accent-hover); background: var(--accent-hover);
} }
/* The <i> fills the button and flex-centres its ::before glyph, so neither /* Inline SVG arrow — centred in its own viewBox, so no font baseline/bearing
Bootstrap Icons' vertical-align:-.125em nor glyph side-bearing can offset it */ offsets. grid place-items on the button does the rest. */
.back-to-top i { .back-to-top svg {
display: flex; display: block;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
line-height: 1;
} }
/* ======================================== /* ========================================
+3 -1
View File
@@ -644,7 +644,9 @@
btn.type = 'button'; btn.type = 'button';
btn.className = 'back-to-top'; btn.className = 'back-to-top';
btn.setAttribute('aria-label', T.backToTop); btn.setAttribute('aria-label', T.backToTop);
btn.innerHTML = '<i class="bi bi-arrow-up" aria-hidden="true"></i>'; btn.innerHTML = '<svg viewBox="0 0 24 24" width="20" height="20" fill="none" ' +
'stroke="currentColor" stroke-width="2" stroke-linecap="round" ' +
'stroke-linejoin="round" aria-hidden="true"><path d="M12 19V5M5 12l7-7 7 7"/></svg>';
document.body.appendChild(btn); document.body.appendChild(btn);
btn.addEventListener('click', function () { btn.addEventListener('click', function () {