Caleb Porzio 1 năm trước cách đây
mục cha
commit
3bb1e5596e
1 tập tin đã thay đổi với 1 bổ sung14 xóa
  1. 1 14
      packages/focus/src/index.js

+ 1 - 14
packages/focus/src/index.js

@@ -137,22 +137,9 @@ export default function (Alpine) {
                     if (modifiers.includes('noscroll')) undoDisableScrolling = disableScrolling()
                     if (modifiers.includes('inert')) undoInert = setInert(el)
 
-                    // Activate the trap after two ticks. (Needed to play nice with transitions...)
+                    // Activate the trap after a generous tick. (Needed to play nice with transitions...)
                     setTimeout(() => {
                         trap.activate()
-
-                        // Set cursor to the end of the text in the input
-                        // Internally, the "focus-trap" package calls ".select()" when
-                        // focusing an input element as the first element.
-                        // This is odd behavior, this bit of code deselects the contents
-                        // and puts the cursor at the end...
-                        setTimeout(() => {
-                            let node = document.activeElement
-                            if (node && node.tagName && node.tagName.toLowerCase() === 'input') {
-                                node.focus()
-                                node.setSelectionRange(node.value.length, node.value.length)
-                            }
-                        })
                     }, 15)
                 }