fix(components): [collapse] fix accessibility issues (#13832)

Using tab related aria attributes results in accessibility issues
This commit is contained in:
Karolis_Stoncius_Sneakybox 2023-09-12 03:21:35 +03:00 committed by GitHub
parent 06e85824df
commit d791229a6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 20 deletions

View File

@ -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"
>

View File

@ -1,5 +1,5 @@
<template>
<div :class="rootKls" role="tablist" aria-multiselectable="true">
<div :class="rootKls">
<slot />
</div>
</template>

View File

@ -18,6 +18,9 @@
}
}
@include e(header) {
width: 100%;
padding: 0;
border: none;
display: flex;
align-items: center;
height: getCssVar('collapse-header-height');