From 41cff6f940a0c5cc11e825cf56f5db82f10d2d38 Mon Sep 17 00:00:00 2001 From: Nick Oates Date: Fri, 15 Mar 2024 14:47:03 -0700 Subject: [PATCH] Disable CSS transitions when changing theme --- composables/theme.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/composables/theme.js b/composables/theme.js index dfc6acc0ef..d0c94b4d24 100644 --- a/composables/theme.js +++ b/composables/theme.js @@ -48,7 +48,13 @@ export const updateTheme = (value, updatePreference = false) => { } if (process.client) { + const css = document.createElement('style') + css.appendChild(document.createTextNode('*,*::after,*::before{transition:none!important}')) + document.head.appendChild(css) + document.documentElement.className = `${theme.value.value}-mode` + + setTimeout(() => document.head.removeChild(css), 1) } themeCookie.value = theme.value