From 17596e29f71b3cbe4d4a6231267fc3efd566cb74 Mon Sep 17 00:00:00 2001 From: Jelmer de Maat Date: Fri, 26 Nov 2021 11:09:58 +0100 Subject: [PATCH 1/2] Add existing focusable elements to correctly manage tab key navigation --- index.js | 2 +- package-lock.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 8adc5ad..8e0117a 100644 --- a/index.js +++ b/index.js @@ -126,7 +126,7 @@ function isFormMethodDialog(el) { function findFocusableElementWithin(hostElement) { // Note that this is 'any focusable area'. This list is probably not exhaustive, but the // alternative involves stepping through and trying to focus everything. - var opts = ['button', 'input', 'keygen', 'select', 'textarea']; + var opts = ['button', 'input', 'keygen', 'select', 'textarea', 'a[href]', 'area[href]', 'iframe', 'object', 'embed']; var query = opts.map(function(el) { return el + ':not([disabled])'; }); diff --git a/package-lock.json b/package-lock.json index e9c7d2b..3519463 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "dialog-polyfill", - "version": "0.5.5", + "version": "0.5.6", "lockfileVersion": 1, "requires": true, "dependencies": { From fd06c6715201370f90c9568e733c01bfc2400c53 Mon Sep 17 00:00:00 2001 From: Jelmer de Maat Date: Fri, 26 Nov 2021 11:12:40 +0100 Subject: [PATCH 2/2] Add any element with [contenteditable] attribute to focusable elements --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 8e0117a..a903d8a 100644 --- a/index.js +++ b/index.js @@ -126,7 +126,7 @@ function isFormMethodDialog(el) { function findFocusableElementWithin(hostElement) { // Note that this is 'any focusable area'. This list is probably not exhaustive, but the // alternative involves stepping through and trying to focus everything. - var opts = ['button', 'input', 'keygen', 'select', 'textarea', 'a[href]', 'area[href]', 'iframe', 'object', 'embed']; + var opts = ['button', 'input', 'keygen', 'select', 'textarea', 'a[href]', 'area[href]', 'iframe', 'object', 'embed', '[contenteditable]']; var query = opts.map(function(el) { return el + ':not([disabled])'; });