From e412c3a228a484ea8cc6233cc9091c609c799216 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Wed, 4 May 2016 12:37:59 +0200 Subject: [PATCH] Make sure focus is set after timeout, to not skewer content. HFJ-1867 --- js/h5p-confirmation-dialog.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/js/h5p-confirmation-dialog.js b/js/h5p-confirmation-dialog.js index 1d08ab6..a8d4ac2 100644 --- a/js/h5p-confirmation-dialog.js +++ b/js/h5p-confirmation-dialog.js @@ -188,20 +188,19 @@ H5P.ConfirmationDialog = (function (EventDispatcher) { popup.classList.remove('hidden'); popupBackground.classList.remove('hiding'); - // Focus confirm button - confirmButton.focus(); + setTimeout(function () { + // Focus confirm button + confirmButton.focus(); - // Resize iFrame if necessary - if (resizeIFrame && options.instance) { - setTimeout(function () { + // Resize iFrame if necessary + if (resizeIFrame && options.instance) { var minHeight = parseInt(popup.offsetHeight, 10) + exitButtonOffset + (2 * shadowOffset); wrapperElement.style.minHeight = minHeight + 'px'; options.instance.trigger('resize'); resizeIFrame = false; - }, 100); - } - + } + }, 100); }, 0); return this;