mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-04 20:27:44 +08:00
feat(components): [switch] add label attribute for accessibility (#14319)
* feat(components): [switch] add label attribute for accessibility * refactor(components): [switch] set default switch label to undefined * docs: version change
This commit is contained in:
parent
40b64dfb57
commit
26e9727299
@ -115,6 +115,7 @@ switch/custom-action-icon
|
||||
| before-change | before-change hook before the switch state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop switching | ^[boolean] / ^[Function]`() => Promise<boolean>` | — |
|
||||
| id | id for input | ^[string] | — |
|
||||
| tabindex | tabindex for input | ^[string] / ^[number] | — |
|
||||
| label ^(2.4.1) ^(a11y) | same as `aria-label` in native input | ^[string] | — |
|
||||
|
||||
### Events
|
||||
|
||||
|
@ -169,6 +169,13 @@ export const switchProps = buildProps({
|
||||
type: [Boolean, String, Number],
|
||||
default: false,
|
||||
},
|
||||
/**
|
||||
* @description native input aria-label
|
||||
*/
|
||||
label: {
|
||||
type: String,
|
||||
default: undefined,
|
||||
},
|
||||
} as const)
|
||||
|
||||
export type SwitchProps = ExtractPropTypes<typeof switchProps>
|
||||
|
@ -8,6 +8,7 @@
|
||||
role="switch"
|
||||
:aria-checked="checked"
|
||||
:aria-disabled="switchDisabled"
|
||||
:aria-label="label"
|
||||
:name="name"
|
||||
:true-value="activeValue"
|
||||
:false-value="inactiveValue"
|
||||
|
Loading…
Reference in New Issue
Block a user