Skip to content

Commit

Permalink
Use proper root when checking for focused element
Browse files Browse the repository at this point in the history
Issue #588
  • Loading branch information
marijnh committed Mar 16, 2017
1 parent d1f2819 commit 5dfbaab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class EditorView {
// :: () → bool
// Query whether the view has focus.
hasFocus() {
if (this.editable && this.dom.ownerDocument.activeElement != this.dom) return false
if (this.editable && this.root.activeElement != this.dom) return false
let sel = this.root.getSelection()
return sel.rangeCount && this.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode)
}
Expand Down

0 comments on commit 5dfbaab

Please sign in to comment.