From 09dc3a9110ea205720963ec4cd0d84bb5c59375b Mon Sep 17 00:00:00 2001 From: Juan Carlos Medina Date: Sun, 21 Jun 2020 19:42:24 -0700 Subject: [PATCH] refactor(tab): remove tabIndex set and unset for jsdom (#379) --- src/tab.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/tab.js b/src/tab.js index 49817240..96ae333a 100644 --- a/src/tab.js +++ b/src/tab.js @@ -103,16 +103,7 @@ function tab({shift = false, focusTrap} = {}) { !continueToTab && previousElement ? previousElement : nextElement if (continueToTab) { - const hasTabIndex = nextElement.getAttribute('tabindex') !== null - if (!hasTabIndex) { - nextElement.setAttribute('tabindex', '0') // jsdom requires tabIndex=0 for an item to become 'document.activeElement' - } - focus(nextElement) - - if (!hasTabIndex) { - nextElement.removeAttribute('tabindex') // leave no trace. :) - } } fireEvent.keyUp(keyUpTarget, {...tabKeyInit})