Skip to content

Commit b247c00

Browse files
committed
Do not allow focus when disabled
1 parent f95b9bb commit b247c00

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Toggle.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div
33
:class="classList.container"
4-
:tabindex="disabled ? -1 : 0"
4+
:tabindex="disabled ? undefined : 0"
55
:aria-checked="checked"
66
:aria-describedby="describedby"
77
:aria-labelledby="labelledby"

src/composables/useKeyboard.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { ref, computed, toRefs } from 'composition-api'
22

33
export default function useStyle (props, context, dependencies)
44
{
5+
const { disabled } = toRefs(props)
6+
57
// ============ DEPENDENCIES ============
68

79
const check = dependencies.check
@@ -11,6 +13,10 @@ export default function useStyle (props, context, dependencies)
1113
// =============== METHODS ==============
1214

1315
const handleSpace = () => {
16+
if (disabled.value) {
17+
return
18+
}
19+
1420
checked.value ? uncheck() : check()
1521
}
1622

0 commit comments

Comments
 (0)