diff options
author | Jordan Hofker <jhofker@gmail.com> | 2015-02-19 16:09:08 -0600 |
---|---|---|
committer | Jordan Hofker <jhofker@gmail.com> | 2015-02-19 16:09:08 -0600 |
commit | 76c5726c040000a6d8ae3122681b3afb5e309c85 (patch) | |
tree | da5c44f3341eb08f6b81cca2fc3f0cdefb763ff6 /js | |
parent | ce8ea8439305913a9be6322fcd445814c521e724 (diff) | |
download | perl-software-in-gnu-guix-76c5726c040000a6d8ae3122681b3afb5e309c85.tar perl-software-in-gnu-guix-76c5726c040000a6d8ae3122681b3afb5e309c85.tar.gz |
Check before calling blur on activeElement.
It's possible for slides to be in a situation where the last clicked thing was an SVG before the tab/window loses focus. When returning, `.blur()` is called on the previously-active element, but can result in an exception.
This protects against that and will only call `.blur()` when `document.activeElement` supports it.
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/js/reveal.js b/js/reveal.js index 65ac29f..6a8c2a3 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -3872,7 +3872,10 @@ // If, after clicking a link or similar and we're coming back, // focus the document.body to ensure we can use keyboard shortcuts if( isHidden === false && document.activeElement !== document.body ) { - document.activeElement.blur(); + // Not all elements support .blur() - SVGs among them. + if (typeof document.activeElement.blur === 'function') { + document.activeElement.blur(); + } document.body.focus(); } |