Gracefully handle focus prior to detecting the editor has become visible

This commit is contained in:
Nathan Sobo
2017-03-15 21:05:56 -06:00
committed by Antonio Scandurra
parent 82feef9f68
commit 401434858b
2 changed files with 20 additions and 0 deletions

View File

@@ -676,6 +676,12 @@ class TextEditorComponent {
// against that case.
if (!this.attached) this.didAttach()
// The element can be focused before the intersection observer detects that
// it has been shown for the first time. If this element is being focused,
// it is necessarily visible, so we call `didShow` to ensure the hidden
// input is rendered before we try to shift focus to it.
if (!this.visible) this.didShow()
if (!this.focused) {
this.focused = true
this.scheduleUpdate()