fix: add transition effect to language switch
Apply transitioning class during language toggle to prevent content flash when switching between English and German.
This commit is contained in:
@@ -118,6 +118,10 @@ function toggleExpectedResult() {
|
|||||||
async function toggleLanguage() {
|
async function toggleLanguage() {
|
||||||
const currentLang = getLanguage();
|
const currentLang = getLanguage();
|
||||||
const newLang = currentLang === "en" ? "de" : "en";
|
const newLang = currentLang === "en" ? "de" : "en";
|
||||||
|
|
||||||
|
// Add transition class before any updates
|
||||||
|
elements.editorSection?.classList.add("transitioning");
|
||||||
|
|
||||||
setLanguage(newLang);
|
setLanguage(newLang);
|
||||||
applyTranslations();
|
applyTranslations();
|
||||||
|
|
||||||
@@ -138,6 +142,11 @@ async function toggleLanguage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateProgressDisplay();
|
updateProgressDisplay();
|
||||||
|
|
||||||
|
// Remove transition class after all updates
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
elements.editorSection?.classList.remove("transitioning");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================= HINT SYSTEM =================
|
// ================= HINT SYSTEM =================
|
||||||
|
|||||||
Reference in New Issue
Block a user