mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-17 13:01:46 +08:00
feat(components): [date-picker] work with modal focus trap; a11y controls and attributes (#7598)
* feat(components): [date-picker] a11y controls and attributes * feat(components): [date-picker] keyboard controls for picker * feat(components): [date-picker] unit test complete * feat(components): [date-picker] remove immediate watch date
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div
|
||||
v-show="type !== 'hidden'"
|
||||
v-bind="containerAttrs"
|
||||
:class="[
|
||||
type === 'textarea' ? nsTextarea.b() : nsInput.b(),
|
||||
nsInput.m(inputSize),
|
||||
@ -18,6 +19,7 @@
|
||||
$attrs.class,
|
||||
]"
|
||||
:style="containerStyle"
|
||||
:role="containerRole"
|
||||
@mouseenter="handleMouseEnter"
|
||||
@mouseleave="handleMouseLeave"
|
||||
>
|
||||
@ -208,7 +210,21 @@ const instance = getCurrentInstance()!
|
||||
const rawAttrs = useRawAttrs()
|
||||
const slots = useSlots()
|
||||
|
||||
const attrs = useAttrs()
|
||||
const containerAttrs = computed<Record<string, unknown>>(() => {
|
||||
const comboBoxAttrs = {}
|
||||
if (props.containerRole === 'combobox') {
|
||||
comboBoxAttrs['aria-haspopup'] = rawAttrs['aria-haspopup']
|
||||
comboBoxAttrs['aria-owns'] = rawAttrs['aria-owns']
|
||||
comboBoxAttrs['aria-expanded'] = rawAttrs['aria-expanded']
|
||||
}
|
||||
return comboBoxAttrs
|
||||
})
|
||||
|
||||
const attrs = useAttrs({
|
||||
excludeKeys: computed<string[]>(() => {
|
||||
return Object.keys(containerAttrs.value)
|
||||
}),
|
||||
})
|
||||
const { form, formItem } = useFormItem()
|
||||
const { inputId } = useFormItemInputId(props, {
|
||||
formItemContext: formItem,
|
||||
|
Reference in New Issue
Block a user