From 08ff2f31731866975384564ba3db65f3e587f595 Mon Sep 17 00:00:00 2001 From: d11n Date: Tue, 28 Mar 2023 13:12:47 +0200 Subject: [PATCH] Checkout: Fix language select width in modal (#4823) --- BTCPayServer/wwwroot/checkout-v2/checkout.css | 3 +-- BTCPayServer/wwwroot/checkout-v2/checkout.js | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/BTCPayServer/wwwroot/checkout-v2/checkout.css b/BTCPayServer/wwwroot/checkout-v2/checkout.css index e91b5d2f8..ce7dfd8c8 100644 --- a/BTCPayServer/wwwroot/checkout-v2/checkout.css +++ b/BTCPayServer/wwwroot/checkout-v2/checkout.css @@ -179,8 +179,7 @@ section dl > div dd { background: rgba(var(--btcpay-black-rgb), 0.85); } .checkout-modal h1, -.checkout-modal footer a:hover, -.checkout-modal #DefaultLang:hover { +.checkout-modal footer a:hover { color: var(--btcpay-white); } diff --git a/BTCPayServer/wwwroot/checkout-v2/checkout.js b/BTCPayServer/wwwroot/checkout-v2/checkout.js index 254d756dd..7f98a3e99 100644 --- a/BTCPayServer/wwwroot/checkout-v2/checkout.js +++ b/BTCPayServer/wwwroot/checkout-v2/checkout.js @@ -62,7 +62,11 @@ function updateLanguageSelect() { $languageSelect.parentElement.appendChild(element); const width = element.offsetWidth; $languageSelect.parentElement.removeChild(element); - $languageSelect.style.setProperty('--text-width', `${width}px`); + if (width && width > 0) { + $languageSelect.style.setProperty('--text-width', `${width}px`); + } else { // in case of modal this might not be rendered properly yet + window.requestAnimationFrame(updateLanguageSelect); + } } function updateLanguage(lang) {