[super.render()] lang attribute flips to en with re-rendered elements
Root Cause
this element misses to catch lang-updated events from boundElement since the event listener is added AFTER a lang-updated event is dispatched
Fix
If boundElement.lang is different from this.lang at its boundElement association, this.lang has to be initialized by boundElement.lang as this element should have missed the lang-updated event.
Workarounds
Option # 1 - Specify lang attribute explicitly
html`${bind(this)}
${repeat(this.timezones,
(item) => item,
(item, index) =>
html`<world-clock .timezone=${item} lang=${this.lang} discard-on-disconnect>
<!-- explicitly set lang attribute to work around the flapping language issue on reconnect --></world-clock>`)}`
Option # 2 - static get observeHtmlLang() { return false; } and set lang attribute explicitly
[
super.render()
]lang
attribute flips toen
with re-rendered elementsRoot Cause
this
element misses to catchlang-updated
events fromboundElement
since the event listener is added AFTER alang-updated
event is dispatchedFix
boundElement.lang
is different fromthis.lang
at itsboundElement
association,this.lang
has to be initialized byboundElement.lang
asthis
element should have missed thelang-updated
event.Workarounds
lang
attribute explicitlystatic get observeHtmlLang() { return false; }
and setlang
attribute explicitly