diff options
author | Albin Larsson <mail@albinlarsson.com> | 2018-06-12 19:39:26 +0200 |
---|---|---|
committer | Albin Larsson <mail@albinlarsson.com> | 2018-06-12 19:39:26 +0200 |
commit | 53933dff7eaa8074e57cccc7cab18d5be6c83fc4 (patch) | |
tree | 3b9e3a042a8396c2ac977b9705acda48df6be4ef /src | |
parent | f15c1344b0975e7f692492b775062489ee4b1302 (diff) | |
download | plyr-53933dff7eaa8074e57cccc7cab18d5be6c83fc4.tar.lz plyr-53933dff7eaa8074e57cccc7cab18d5be6c83fc4.tar.xz plyr-53933dff7eaa8074e57cccc7cab18d5be6c83fc4.zip |
Use toggleListener in trapFocus
Diffstat (limited to 'src')
-rw-r--r-- | src/js/utils/elements.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/js/utils/elements.js b/src/js/utils/elements.js index 4d4f97cd..55866367 100644 --- a/src/js/utils/elements.js +++ b/src/js/utils/elements.js @@ -2,7 +2,7 @@ // Element utils // ========================================================================== -import { off, on } from './events'; +import { toggleListener } from './events'; import is from './is'; // Wrap an element @@ -277,11 +277,7 @@ export function trapFocus(element = null, toggle = false) { } }; - if (toggle) { - on(this.elements.container, 'keydown', trap, false); - } else { - off(this.elements.container, 'keydown', trap, false); - } + toggleListener.call(this, this.elements.container, 'keydown', trap, toggle, false); } // Toggle aria-pressed state on a toggle button |