HFP-1763 Simplify logic

HFP-2862-fix-download-warning
Paal Joergensen 2019-09-26 12:58:15 +02:00
parent 4d061aef7a
commit e6fa3d7e54
1 changed files with 3 additions and 15 deletions

View File

@ -365,21 +365,9 @@ H5P.init = function (target) {
H5P.trigger(instance, 'resize'); H5P.trigger(instance, 'resize');
// Logic for hiding focus effects when using mouse // Logic for hiding focus effects when using mouse
const wrapper = $element[0]; $element.addClass('using-mouse');
wrapper.classList.add('using-mouse'); $element.on('mousedown keydown keyup', function (event) {
$element.toggleClass('using-mouse', event.type === 'mousedown');
// Switch between focus modes
wrapper.addEventListener('mousedown', function () {
wrapper.classList.add('using-mouse');
});
wrapper.addEventListener('keydown', function () {
wrapper.classList.remove('using-mouse');
});
// Make sure using-mouse is removed on the first tab into content as well
wrapper.addEventListener('keyup', function () {
wrapper.classList.remove('using-mouse');
}); });
}); });