From b3c55928e375a75f098be6be1344d61e1675663b Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 9 Jun 2016 15:26:15 +0200 Subject: [PATCH] Remove tabindex of exitButton in confirmation dialog. Trapped focus between confirm and cancel button. HFJ-2004 --- js/h5p-confirmation-dialog.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/js/h5p-confirmation-dialog.js b/js/h5p-confirmation-dialog.js index 481429f..a06166b 100644 --- a/js/h5p-confirmation-dialog.js +++ b/js/h5p-confirmation-dialog.js @@ -16,7 +16,7 @@ H5P.ConfirmationDialog = (function (EventDispatcher) { function ConfirmationDialog(options) { EventDispatcher.call(this); var self = this; - + // Make sure confirmation dialogs have unique id H5P.ConfirmationDialog.uniqueId += 1; var uniqueId = H5P.ConfirmationDialog.uniqueId; @@ -126,6 +126,7 @@ H5P.ConfirmationDialog = (function (EventDispatcher) { var exitButton = document.createElement('button'); exitButton.classList.add('h5p-confirmation-dialog-exit'); exitButton.setAttribute('aria-hidden', 'true'); + exitButton.tabIndex = -1; exitButton.title = options.cancelText; // Cancel handler @@ -135,7 +136,7 @@ H5P.ConfirmationDialog = (function (EventDispatcher) { dialogCanceled(e); } else if (e.which === 9 && e.shiftKey) { // Shift-tab - flowTo(exitButton, e); + flowTo(confirmButton, e); } }); buttons.appendChild(cancelButton); @@ -146,6 +147,9 @@ H5P.ConfirmationDialog = (function (EventDispatcher) { if (e.which === 32) { // Space dialogConfirmed(e); } + else if (e.which === 9 && !e.shiftKey) { // Tab + flowTo(cancelButton, e); + } }); buttons.appendChild(confirmButton); @@ -155,9 +159,6 @@ H5P.ConfirmationDialog = (function (EventDispatcher) { if (e.which === 32) { // Space dialogCanceled(e); } - else if (e.which === 9 && !e.shiftKey) { // Tab - flowTo(cancelButton, e); - } }); popup.appendChild(exitButton);