fix: prevent language selector text clipping

This commit is contained in:
KoalaDev
2026-07-28 07:46:07 +02:00
parent ffd629a522
commit 172073896f
2 changed files with 20 additions and 1 deletions
+17 -1
View File
@@ -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 => {
+3
View File
@@ -182,4 +182,7 @@
font-size: 1rem;
gap: 0.4rem;
}
.logo-area > span:first-of-type {
display: none;
}
}