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() {
|
||||
const currentLang = getLanguage();
|
||||
const newLang = currentLang === "en" ? "de" : "en";
|
||||
|
||||
// Add transition class before any updates
|
||||
elements.editorSection?.classList.add("transitioning");
|
||||
|
||||
setLanguage(newLang);
|
||||
applyTranslations();
|
||||
|
||||
@@ -138,6 +142,11 @@ async function toggleLanguage() {
|
||||
}
|
||||
|
||||
updateProgressDisplay();
|
||||
|
||||
// Remove transition class after all updates
|
||||
requestAnimationFrame(() => {
|
||||
elements.editorSection?.classList.remove("transitioning");
|
||||
});
|
||||
}
|
||||
|
||||
// ================= HINT SYSTEM =================
|
||||
|
||||
Reference in New Issue
Block a user