Explorar el Código

fix: handle dialog tab boundary

jimmylee hace 2 semanas
padre
commit
5a031682c9
Se han modificado 1 ficheros con 7 adiciones y 1 borrados
  1. 7 1
      src/views/Editor/EnglishSpeaking/preview/TaskHintModal.vue

+ 7 - 1
src/views/Editor/EnglishSpeaking/preview/TaskHintModal.vue

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