Skip to content

Commit 3b41b0a

Browse files
committed
added little a11y
1 parent 5cf8cc1 commit 3b41b0a

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

src/components/Container.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
v-show="visible"
66
:class="{ 'vm2__animate-show': blockVisible, 'vm2--dark': darkMode }"
77
:style="{ backgroundColor: wrapperBg }"
8+
tabindex="-1"
9+
aria-hidden="true"
10+
role="dialog"
11+
aria-modal="true"
12+
:aria-labelledby="`dialog ${name}`"
813
>
9-
<div class="vm2_modal-dialog vm2_settings" :class="contentSize? contentSize: ''">
14+
<div class="vm2_modal-dialog vm2_settings" :class="contentSize? contentSize: ''" role="document">
1015
<div
1116
class="vm2_modal-content"
1217
:id="`vm2_box_${name}`"

src/components/withHeader.vue

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
<div>
55
<h4 style="margin: 5px 10px">{{ title }}</h4>
66
</div>
7-
<div class="vm2__close" @click="handleIconClick" v-html="closeIcon"></div>
7+
<button
8+
ref="closeButton"
9+
aria-label="Close"
10+
role="button"
11+
aria-pressed="false"
12+
class="vm2__close"
13+
@click="handleIconClick">
14+
<span v-html="closeIcon" aria-hidden="true"></span>
15+
</button>
816
</div>
917
<slot v-else />
1018
<hr class="vm2__hr" />
@@ -36,6 +44,14 @@ export default {
3644
return "&#x2715;";
3745
}
3846
},
47+
mounted () {
48+
this.nextTick(() => {
49+
this.$refs.closeButton.focus();
50+
});
51+
setTimeout(() => {
52+
this.$refs.closeButton.focus();
53+
}, 300);
54+
}
3955
};
4056
</script>
4157

@@ -47,6 +63,7 @@ export default {
4763
}
4864
.vm2__close {
4965
margin: 5px;
66+
padding: 0 4px;
5067
cursor: pointer;
5168
}
5269
.vm2__close:hover {
@@ -61,4 +78,9 @@ export default {
6178
border: 0;
6279
border-top: 1px solid rgba(0, 0, 0, 0.1);
6380
}
81+
button[role="button"] {
82+
border: transparent;
83+
background-color: transparent;
84+
font-size: 16px;
85+
}
6486
</style>

0 commit comments

Comments
 (0)