We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0eea882 commit 1e5407fCopy full SHA for 1e5407f
src/VueSkipToSingle.vue
@@ -9,6 +9,8 @@
9
</template>
10
11
<script>
12
+import { programmaticFocus } from './util'
13
+
14
const focusedTags = new RegExp('^(a|select|input|button|textarea)', 'i')
15
16
export default {
@@ -34,10 +36,8 @@ export default {
34
36
if (!id) return
35
37
const element = window.document.getElementById(id)
38
if (!element) return
- const isFocused = focusedTags.test(element.tagName.toLowerCase())
- !isFocused && element.setAttribute('tabindex', -1)
39
+ if (!focusedTags.test(element.tagName.toLowerCase())) return programmaticFocus(element)
40
element.focus()
- !isFocused && element.removeAttribute('tabindex')
41
}
42
43
0 commit comments