From 1993fda3eeb27cd224a368e5bde7c8b33e2c433f Mon Sep 17 00:00:00 2001 From: Sarbbottam Bandyopadhyay Date: Sat, 8 Aug 2015 21:41:38 -0700 Subject: [PATCH] restrict tab navigation within the modal --- example/common.js | 4 +++- example/index.html | 6 +++--- src/modal.js | 24 ++++++++++++++++++++++++ test/modal.js | 39 ++++++++++++++++++++++++++++++++++++--- 4 files changed, 66 insertions(+), 7 deletions(-) diff --git a/example/common.js b/example/common.js index fc8c7db..95fe15f 100644 --- a/example/common.js +++ b/example/common.js @@ -7,6 +7,7 @@ var modalContainer = document.getElementById('modal'); var primaryButton = modalContainer.querySelector('.js-button-primary'); var secondaryButton = modalContainer.querySelector('.js-button-secondary'); var closeButton = modalContainer.querySelector('.js-button-close'); +var focusableNodeList = Array.prototype.slice.call(modalContainer.querySelectorAll('.js-focusable')); var showButton = document.getElementById('show-modal'); @@ -15,7 +16,8 @@ modal = new Modal({ modalContainer: modalContainer, primaryButton: primaryButton, secondaryButton: secondaryButton, - closeButton: closeButton + closeButton: closeButton, + focusableNodeList: focusableNodeList }); modal.init(); diff --git a/example/index.html b/example/index.html index 4f866fd..9b11381 100644 --- a/example/index.html +++ b/example/index.html @@ -25,7 +25,7 @@