From ff29e93b4f1c61d3682dd480e52219caf263d1c7 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Fri, 9 Aug 2024 16:19:23 +0800 Subject: [PATCH] Fix RTL observer not working --- src/utils/is-rtl.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/is-rtl.js b/src/utils/is-rtl.js index 0a868f48..5e4b5a4e 100644 --- a/src/utils/is-rtl.js +++ b/src/utils/is-rtl.js @@ -4,12 +4,13 @@ let IS_RTL = false; const observer = new MutationObserver((mutations) => { mutations.forEach((mutation) => { if (mutation.type === 'attributes') { - const { value } = mutation.target; - if (value === 'rtl') { + const { dir } = mutation.target; + if (dir === 'rtl') { IS_RTL = true; } else { IS_RTL = false; } + console.log({ IS_RTL }); // Fire custom event 'dirchange' on document // document.dispatchEvent(new Event('dirchange')); }