Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

A11y fix skip areas #1773

Merged
merged 3 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/components/OcSidebarNav.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { shallowMount } from "@vue/test-utils"
import CompressionPlugin from "compression-webpack-plugin"
import Sidebar from "./OcSidebarNav.vue"

const defaultProps = {
Expand All @@ -10,29 +9,29 @@ const defaultProps = {
const slots = {
header: '<span class="header">Logo</span>',
nav: '<span class="nav">Nav</span>',
footer: '<span class="footer">Footer</span>'
footer: '<span class="footer">Footer</span>',
}

describe("OcSidebarNav", () => {
it('displays all slots', () => {
it("displays all slots", () => {
const wrapper = shallowMount(Sidebar, {
propsData: defaultProps,
slots
slots,
})

expect(wrapper.findAll('.header').length).toBe(1)
expect(wrapper.findAll('.nav').length).toBe(1)
expect(wrapper.findAll('.footer').length).toBe(1)
expect(wrapper.findAll(".header").length).toBe(1)
expect(wrapper.findAll(".nav").length).toBe(1)
expect(wrapper.findAll(".footer").length).toBe(1)
})

it('sets all accessible labels', () => {
it("sets all accessible labels", () => {
const wrapper = shallowMount(Sidebar, {
propsData: defaultProps,
slots
slots,
})

expect(wrapper.find('header').attributes()['aria-label']).toMatch('sidebar-header')
expect(wrapper.find('nav').attributes()['aria-label']).toMatch('sidebar-nav')
expect(wrapper.find('footer').attributes()['aria-label']).toMatch('sidebar-footer')
expect(wrapper.find("figure").attributes()["aria-label"]).toMatch("sidebar-header")
expect(wrapper.find("nav").attributes()["aria-label"]).toMatch("sidebar-nav")
expect(wrapper.find("footer").attributes()["aria-label"]).toMatch("sidebar-footer")
})
})
4 changes: 2 additions & 2 deletions src/components/OcSidebarNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
:class="[data.staticClass, data.class]"
v-bind="data.attrs"
>
<header
<figure
v-if="slots().header"
class="oc-sidebar-header"
:aria-label="props.accessibleLabelHeader"
>
<!-- @slot Header of the sidebar -->
<slot name="header" />
</header>
</figure>
<nav v-if="slots().nav" class="oc-sidebar-nav" :aria-label="props.accessibleLabelNav">
<!-- @slot Main content of the sidebar -->
<slot name="nav" />
Expand Down