Skip to content

Commit 2a3f86c

Browse files
committed
feat(radio, checkbox, switch): support tabindex
1 parent bd437a8 commit 2a3f86c

File tree

19 files changed

+28
-7
lines changed

19 files changed

+28
-7
lines changed

packages/varlet-ui/src/checkbox-group/docs/en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ const value = ref([])
349349
| `indeterminate` | Whether indeterminate status(style has the highest priority) | _boolean_ | `false` |
350350
| `ripple` | Whether to open ripple | _boolean_ | `true` |
351351
| `rules` | Validation rules, return `true` to indicate verification passes, other types of values ​​will be converted into text as user prompts. [Zod validation](#/en-US/zodValidation) is supported since `3.5.0` | _(v: string) => any \| ZodType \| Array<(v: string) => any \| ZodType>_ | `-` |
352+
| `tabindex` ***3.12.2*** | Consistent with the tabindex property of native input | _string_ | `-` |
352353

353354
### Methods
354355

packages/varlet-ui/src/checkbox-group/docs/zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ const value = ref([])
348348
| `indeterminate` | 是否为不确定状态(样式优先级最高) | _boolean_ | `false` |
349349
| `ripple` | 是否开启水波纹 | _boolean_ | `true` |
350350
| `rules` | 验证规则,返回 `true` 表示验证通过,其它类型的值将转换为文本作为用户提示。自 `3.5.0` 开始支持 [Zod 验证](#/zh-CN/zodValidation) | _(v: string) => any \| ZodType \| Array<(v: string) => any \| ZodType>_ | `-` |
351+
| `tabindex` ***3.12.2*** | 与原生 input 的 tabindex 属性一致 | _string_ | `-` |
351352

352353
### 方法
353354

packages/varlet-ui/src/checkbox/Checkbox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
:aria-checked="isIndeterminate ? 'mixed' : checked"
77
:aria-disabled="formDisabled || disabled"
88
:class="n()"
9-
:tabindex="disabled || formDisabled ? undefined : '0'"
9+
:tabindex="tabindex == null ? (disabled || formDisabled ? undefined : '0') : tabindex"
1010
@focus="isFocusing = true"
1111
@blur="isFocusing = false"
1212
@click="handleClick"

packages/varlet-ui/src/checkbox/docs/en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
| `indeterminate` | Whether indeterminate status(style has the highest priority) | _boolean_ | `false` |
1616
| `ripple` | Whether to open ripple | _boolean_ | `true` |
1717
| `rules` | Validation rules, return `true` to indicate verification passes, other types of values ​​will be converted into text as user prompts. [Zod validation](#/en-US/zodValidation) is supported since `3.5.0` | _((v: any) => any) \| ZodType \| Array<((v: any) => any) \| ZodType>_ | `-` |
18+
| `tabindex` ***3.12.2*** | Consistent with the tabindex property of native input | _string_ | `-` |
1819

1920
### Events
2021

packages/varlet-ui/src/checkbox/docs/zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
| `indeterminate` | 是否为不确定状态(样式优先级最高) | _boolean_ | `false` |
1616
| `ripple` | 是否开启水波纹 | _boolean_ | `true` |
1717
| `rules` | 验证规则,返回 `true` 表示验证通过,其它类型的值将转换为文本作为用户提示。自 `3.5.0` 开始支持 [Zod 验证](#/zh-CN/zodValidation) | _((v: any) => any) \| ZodType \| Array<((v: any) => any) \| ZodType>_ | `-` |
18+
| `tabindex` ***3.12.2*** | 与原生 input 的 tabindex 属性一致 | _string_ | `-` |
1819

1920
### 事件
2021

packages/varlet-ui/src/checkbox/props.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { PropType } from 'vue'
1+
import type { InputHTMLAttributes, PropType } from 'vue'
22
import { defineListenerProp } from '../utils/components'
33

44
export type CheckboxValidateTrigger = 'onChange'
@@ -21,6 +21,7 @@ export const props = {
2121
disabled: Boolean,
2222
readonly: Boolean,
2323
indeterminate: Boolean,
24+
tabindex: String as PropType<InputHTMLAttributes['tabindex']>,
2425
iconSize: [String, Number],
2526
ripple: {
2627
type: Boolean,

packages/varlet-ui/src/radio-group/docs/en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ const value = ref(false)
293293
| `disabled` | Whether the disabled | _boolean_ | `false` |
294294
| `ripple` | Whether to open ripple | _boolean_ | `true` |
295295
| `rules` | Validation rules, return `true` to indicate verification passes, other types of values ​​will be converted into text as user prompts. [Zod validation](#/en-US/zodValidation) is supported since `3.5.0` | _((v: string) => any) \| ZodType \| Array<((v: string) => any) \| ZodType>_ | `-` |
296+
| `tabindex` ***3.12.2*** | Consistent with the tabindex property of native input | _string_ | `-` |
296297

297298
### Methods
298299

packages/varlet-ui/src/radio-group/docs/zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ const value = ref(false)
293293
| `readonly` | 是否只读 | _boolean_ | `false` |
294294
| `ripple` | 是否开启水波纹 | _boolean_ | `true` |
295295
| `rules` | 验证规则,返回 `true` 表示验证通过,其它类型的值将转换为文本作为用户提示。自 `3.5.0` 开始支持 [Zod 验证](#/zh-CN/zodValidation) | _(v: string) => any \| ZodType \| Array<(v: string) => any \| ZodType>_ | `-` |
296+
| `tabindex` ***3.12.2*** | 与原生 input 的 tabindex 属性一致 | _string_ | `-` |
296297

297298
### 方法
298299

packages/varlet-ui/src/radio/Radio.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ export default defineComponent({
9595
const isChecked = checked.value
9696
const hasCheckedInRadioGroup = radioGroup?.hasChecked.value
9797
98+
if (props.tabindex != null) {
99+
return props.tabindex
100+
}
101+
98102
if (disabled) {
99103
return
100104
}

packages/varlet-ui/src/radio/docs/en-US.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
| `disabled` | Whether the disabled | _boolean_ | `false` |
1515
| `ripple` | Whether to open ripple | _boolean_ | `true` |
1616
| `rules` | Validation rules, return `true` to indicate verification passes, other types of values ​​will be converted into text as user prompts. [Zod validation](#/en-US/zodValidation) is supported since `3.5.0` | _((v: any) => any) \| ZodType \| Array<((v: any) => any) \| ZodType>_ | `-` |
17+
| `tabindex` ***3.12.2*** | Consistent with the tabindex property of native input | _string_ | `-` |
1718

1819
### Events
1920

0 commit comments

Comments
 (0)