From 8ab18a783dbf8e14bb6dbec354e1af656c8b484f Mon Sep 17 00:00:00 2001 From: github-actions-bot Date: Wed, 10 Jan 2024 20:58:42 +0000 Subject: [PATCH] Updates --- inline-module-9e804879e37a77d0185feb25684c241c.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/inline-module-9e804879e37a77d0185feb25684c241c.js b/inline-module-9e804879e37a77d0185feb25684c241c.js index dcc9c14..5ac2f9d 100644 --- a/inline-module-9e804879e37a77d0185feb25684c241c.js +++ b/inline-module-9e804879e37a77d0185feb25684c241c.js @@ -523,7 +523,12 @@ class Trap { const addition = this.tabDirection === 'forward' ? 1 : -1; + let count = 0; while(true) { + if (count >= tabbableElements.length) { + break + } + if (currentFocusIndex + addition >= tabbableElements.length) { currentFocusIndex = 0; } else if (currentFocusIndex + addition < 0) { @@ -552,9 +557,11 @@ class Trap { this.currentFocus?.focus({ preventScroll: this.preventScroll }); // @ts-expect-error - if ([...activeElements()].includes(this.currentFocus)) { + if (![...activeElements()].includes(this.previousFocus)) { break } + + count++; } }