Skip to content

Commit 2dcc679

Browse files
authored
Fix SHIFT + TAB issue on last element in focusTrap (#780)
This will prevent a jump from the last to the first element when you press SHIFT + TAB on the last element, which isn't the first element.
1 parent 1eddcf5 commit 2dcc679

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/focusTrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class FocusTrap {
6565
}
6666

6767
// TAB
68-
if (isNothingFocused() || isFocused(this.lastElement())) {
68+
if (isNothingFocused() || (!event.shiftKey && isFocused(this.lastElement()))) {
6969
this.firstElement().focus()
7070
event.preventDefault()
7171
return

0 commit comments

Comments
 (0)