Skip to content

Commit

Permalink
Fix SHIFT + TAB issue on last element in focusTrap (euvl#780)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JaZo authored Dec 1, 2022
1 parent 1eddcf5 commit 2dcc679
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/focusTrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class FocusTrap {
}

// TAB
if (isNothingFocused() || isFocused(this.lastElement())) {
if (isNothingFocused() || (!event.shiftKey && isFocused(this.lastElement()))) {
this.firstElement().focus()
event.preventDefault()
return
Expand Down

0 comments on commit 2dcc679

Please sign in to comment.