Skip to content

Commit

Permalink
fix: πŸ› handle case when activeElement is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Apr 7, 2019
1 parent ba2a8b6 commit 3d83705
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/useStartTyping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {useLayoutEffect} from 'react';
const isFocusedElementEditable = () => {
const {activeElement, body} = document;

if (!activeElement) return false;

// If not element has focus, we assume it is not editable, too.
if (activeElement === body) return false;

Expand Down

0 comments on commit 3d83705

Please sign in to comment.