@@ -87,6 +87,7 @@ function getLocale(prefs: Preferences | null = null): string {
8787
8888window . t = setupI18n ( lang ) ;
8989window . lang = lang ;
90+ document . documentElement . lang = lang ;
9091translateHTML ( document , t ) ;
9192
9293// Set up RTL layout
@@ -101,9 +102,7 @@ try {
101102 isRtl = true ;
102103 }
103104} catch ( e ) { }
104- if ( isRtl ) {
105- document . documentElement . dir = "rtl" ;
106- }
105+ document . documentElement . dir = isRtl ? "rtl" : "ltr" ;
107106
108107/**
109108 * Open a new popup menu
@@ -157,8 +156,9 @@ function openPopupWindow(
157156 POPUP_FRAME . style . width = size [ 0 ] . toString ( ) + ( type === "pixels" ? "px" : "%" ) ;
158157 POPUP_FRAME . style . height = size [ 1 ] . toString ( ) + ( type === "pixels" ? "px" : "%" ) ;
159158 POPUP_FRAME . onload = ( ) => {
160- if ( isRtl && POPUP_FRAME . contentDocument ?. documentElement ) {
161- POPUP_FRAME . contentDocument . documentElement . dir = "rtl" ;
159+ if ( POPUP_FRAME . contentDocument ?. documentElement ) {
160+ POPUP_FRAME . contentDocument . documentElement . lang = lang ;
161+ POPUP_FRAME . contentDocument . documentElement . dir = isRtl ? "rtl" : "ltr" ;
162162 }
163163 POPUP_FRAME . hidden = false ;
164164 HUB_FRAME . classList . add ( "background" ) ;
@@ -391,9 +391,10 @@ async function initHub() {
391391 capture : true
392392 } ) ;
393393
394- // Set up RTL layout
395- if ( isRtl && HUB_FRAME . contentDocument ?. documentElement ) {
396- HUB_FRAME . contentDocument . documentElement . dir = "rtl" ;
394+ // Set up document attributes
395+ if ( HUB_FRAME . contentDocument ?. documentElement ) {
396+ HUB_FRAME . contentDocument . documentElement . lang = lang ;
397+ HUB_FRAME . contentDocument . documentElement . dir = isRtl ? "rtl" : "ltr" ;
397398 }
398399}
399400
0 commit comments