|
@@ -172,13 +172,19 @@ const containTabFocus = (event: KeyboardEvent) => {
|
|
|
const activeElement = document.activeElement
|
|
const activeElement = document.activeElement
|
|
|
|
|
|
|
|
if (event.shiftKey) {
|
|
if (event.shiftKey) {
|
|
|
- if (activeElement === firstElement || !dialog.contains(activeElement)) {
|
|
|
|
|
|
|
+ if (activeElement === dialog || activeElement === firstElement || !dialog.contains(activeElement)) {
|
|
|
event.preventDefault()
|
|
event.preventDefault()
|
|
|
lastElement.focus()
|
|
lastElement.focus()
|
|
|
}
|
|
}
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (activeElement === dialog) {
|
|
|
|
|
+ event.preventDefault()
|
|
|
|
|
+ firstElement.focus()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (activeElement === lastElement) {
|
|
if (activeElement === lastElement) {
|
|
|
event.preventDefault()
|
|
event.preventDefault()
|
|
|
firstElement.focus()
|
|
firstElement.focus()
|