Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[super.render()] lang attribute flips to en with re-rendered elements #85

Closed
t2ym opened this issue Mar 27, 2019 · 0 comments
Closed

[super.render()] lang attribute flips to en with re-rendered elements #85

t2ym opened this issue Mar 27, 2019 · 0 comments
Labels

Comments

@t2ym
Copy link
Owner

t2ym commented Mar 27, 2019

[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
@t2ym t2ym added the bug label Mar 27, 2019
t2ym added a commit that referenced this issue Mar 28, 2019
…epeat> element, and Fix #85 en lang flipping
@t2ym t2ym closed this as completed in a538e33 Mar 28, 2019
t2ym added a commit that referenced this issue Mar 28, 2019
…epeat> element, and Fix #85 en lang flipping
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant