From 172073896f2688cd7a1bedd4e26a06ccc29a7fb5 Mon Sep 17 00:00:00 2001 From: KoalaDev <6156589+Shik3i@users.noreply.github.com> Date: Tue, 28 Jul 2026 07:46:07 +0200 Subject: [PATCH] fix: prevent language selector text clipping --- website/app.js | 18 +++++++++++++++++- website/styles/legal.css | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/website/app.js b/website/app.js index dd7bd6b..be56afb 100644 --- a/website/app.js +++ b/website/app.js @@ -1593,6 +1593,8 @@ document.addEventListener('DOMContentLoaded', () => { tempSpan.style.fontFamily = style.fontFamily; tempSpan.style.fontSize = style.fontSize; tempSpan.style.fontWeight = style.fontWeight; + tempSpan.style.fontStyle = style.fontStyle; + tempSpan.style.letterSpacing = style.letterSpacing; tempSpan.style.visibility = 'hidden'; tempSpan.style.position = 'absolute'; tempSpan.style.whiteSpace = 'nowrap'; @@ -1602,7 +1604,18 @@ document.addEventListener('DOMContentLoaded', () => { tempSpan.textContent = activeOption.textContent; document.body.appendChild(tempSpan); const textWidth = tempSpan.getBoundingClientRect().width; - select.style.width = (textWidth + 18) + 'px'; + const borderBoxChrome = style.boxSizing === 'border-box' + ? [ + style.paddingLeft, + style.paddingRight, + style.borderLeftWidth, + style.borderRightWidth + ].reduce((total, value) => total + (Number.parseFloat(value) || 0), 0) + : 0; + // Leave a few extra pixels for platform-specific native select + // text rendering. The right padding already reserves the + // visible chevron area. + select.style.width = `${Math.ceil(textWidth + borderBoxChrome + 4)}px`; document.body.removeChild(tempSpan); } }); @@ -1747,6 +1760,9 @@ document.addEventListener('DOMContentLoaded', () => { updateDynamicVersion(); localizeHomeLinks(); initLanguageSelectorValue(); + if (document.fonts?.ready) { + document.fonts.ready.then(adjustDropdownWidth); + } // FAQ Accordion Transition (Web Animations API for smooth vertical spring height collapse/expand) try { document.querySelectorAll('.faq-item').forEach(details => { diff --git a/website/styles/legal.css b/website/styles/legal.css index eda152a..42b3fd3 100644 --- a/website/styles/legal.css +++ b/website/styles/legal.css @@ -182,4 +182,7 @@ font-size: 1rem; gap: 0.4rem; } + .logo-area > span:first-of-type { + display: none; + } }