mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-02 11:17:46 +08:00
fix(components): [collapse] fix accessibility issues (#13832)
Using tab related aria attributes results in accessibility issues
This commit is contained in:
parent
06e85824df
commit
d791229a6a
@ -1,33 +1,29 @@
|
||||
<template>
|
||||
<div :class="rootKls">
|
||||
<div
|
||||
role="tab"
|
||||
<button
|
||||
:id="scopedHeadId"
|
||||
:class="headKls"
|
||||
:aria-expanded="isActive"
|
||||
:aria-controls="scopedContentId"
|
||||
:aria-describedby="scopedContentId"
|
||||
:tabindex="disabled ? -1 : 0"
|
||||
@click="handleHeaderClick"
|
||||
@keydown.space.enter.stop.prevent="handleEnterClick"
|
||||
@focus="handleFocus"
|
||||
@blur="focusing = false"
|
||||
>
|
||||
<div
|
||||
:id="scopedHeadId"
|
||||
:class="headKls"
|
||||
role="button"
|
||||
:tabindex="disabled ? -1 : 0"
|
||||
@click="handleHeaderClick"
|
||||
@keydown.space.enter.self.stop.prevent="handleEnterClick"
|
||||
@focus="handleFocus"
|
||||
@blur="focusing = false"
|
||||
>
|
||||
<slot name="title">{{ title }}</slot>
|
||||
<el-icon :class="arrowKls">
|
||||
<arrow-right />
|
||||
</el-icon>
|
||||
</div>
|
||||
</div>
|
||||
<slot name="title">{{ title }}</slot>
|
||||
<el-icon :class="arrowKls">
|
||||
<arrow-right />
|
||||
</el-icon>
|
||||
</button>
|
||||
|
||||
<el-collapse-transition>
|
||||
<div
|
||||
v-show="isActive"
|
||||
:id="scopedContentId"
|
||||
role="region"
|
||||
:class="itemWrapperKls"
|
||||
role="tabpanel"
|
||||
:aria-hidden="!isActive"
|
||||
:aria-labelledby="scopedHeadId"
|
||||
>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div :class="rootKls" role="tablist" aria-multiselectable="true">
|
||||
<div :class="rootKls">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
@ -18,6 +18,9 @@
|
||||
}
|
||||
}
|
||||
@include e(header) {
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
border: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: getCssVar('collapse-header-height');
|
||||
|
Loading…
Reference in New Issue
Block a user