@@ -1955,6 +1955,7 @@ export const template_visitors = {
1955
1955
let has_content_editable_binding = false ;
1956
1956
let img_might_be_lazy = false ;
1957
1957
let might_need_event_replaying = false ;
1958
+ let has_direction_attribute = false ;
1958
1959
1959
1960
if ( is_custom_element ) {
1960
1961
// cloneNode is faster, but it does not instantiate the underlying class of the
@@ -1970,6 +1971,9 @@ export const template_visitors = {
1970
1971
if ( node . name === 'img' && attribute . name === 'loading' ) {
1971
1972
img_might_be_lazy = true ;
1972
1973
}
1974
+ if ( attribute . name === 'dir' ) {
1975
+ has_direction_attribute = true ;
1976
+ }
1973
1977
if (
1974
1978
( attribute . name === 'value' || attribute . name === 'checked' ) &&
1975
1979
! is_text_attribute ( attribute )
@@ -2170,6 +2174,14 @@ export const template_visitors = {
2170
2174
{ ...context , state }
2171
2175
) ;
2172
2176
2177
+ if ( has_direction_attribute ) {
2178
+ // This fixes an issue with Chromium where updates to text content within an element
2179
+ // does not update the direction when set to auto. If we just re-assign the dir, this fixes it.
2180
+ context . state . update . push (
2181
+ b . stmt ( b . assignment ( '=' , b . member ( node_id , b . id ( 'dir' ) ) , b . member ( node_id , b . id ( 'dir' ) ) ) )
2182
+ ) ;
2183
+ }
2184
+
2173
2185
if ( child_locations . length > 0 ) {
2174
2186
// @ts -expect-error
2175
2187
location . push ( child_locations ) ;
0 commit comments