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

Cherrypick a11y improvements #1571

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions changelog/unreleased/bugfix-table-sort-a11y
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: A11y for table sorting

Table sorting now only happens with one button with native labelling for a11y, not with a span and a button anymore.

https://github.com/owncloud/owncloud-design-system/pull/1533
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: OcDrop remove aria-describedby

The aria-describedby-Attribute which triggers the output should be removed, so
that screenreaders don't read out the whole content on focus.

https://github.com/owncloud/web/issues/5398
5 changes: 4 additions & 1 deletion src/components/OcBreadcrumb.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<nav :class="`oc-breadcrumb oc-breadcrumb-${variation}`">
<nav
:class="`oc-breadcrumb oc-breadcrumb-${variation}`"
:aria-label="$gettext('Breadcrumb navigation')"
>
<ol class="oc-breadcrumb-list">
<li v-for="(item, index) in items" :key="index" class="oc-breadcrumb-list-item">
<router-link v-if="item.to" :aria-current="getAriaCurrent(index)" :to="item.to">{{
Expand Down
3 changes: 0 additions & 3 deletions src/components/OcDrop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ export default {
interactive: true,
plugins: [hideOnEsc],
theme: "none",
aria: {
content: "describedby",
},
onShow(instance) {
hideAll({ exclude: instance })
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/__snapshots__/OcBreadcrumb.spec.js.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`OcBreadcrumb displays all items 1`] = `
<nav class="oc-breadcrumb oc-breadcrumb-default">
<nav aria-label="Breadcrumb navigation" class="oc-breadcrumb oc-breadcrumb-default">
<ol class="oc-breadcrumb-list">
<li class="oc-breadcrumb-list-item">
<router-link-stub tag="a" to="[object Object]">First folder</router-link-stub>
Expand Down Expand Up @@ -37,7 +37,7 @@ exports[`OcBreadcrumb displays all items 1`] = `
`;

exports[`OcBreadcrumb sets correct variation 1`] = `
<nav class="oc-breadcrumb oc-breadcrumb-lead">
<nav aria-label="Breadcrumb navigation" class="oc-breadcrumb oc-breadcrumb-lead">
<ol class="oc-breadcrumb-list">
<li class="oc-breadcrumb-list-item">
<router-link-stub tag="a" to="[object Object]">First folder</router-link-stub>
Expand Down
2 changes: 0 additions & 2 deletions src/components/__snapshots__/OcDrop.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
exports[`OcDrop renders tippy 1`] = `
<div>
<p
aria-describedby="tippy-3"
aria-expanded="true"
id="trigger"
>
Expand Down Expand Up @@ -96,7 +95,6 @@ exports[`OcDrop renders tippy 2`] = `
exports[`OcDrop renders tippy 3`] = `
<div>
<p
aria-describedby="tippy-3"
aria-expanded="true"
id="trigger"
>
Expand Down
11 changes: 7 additions & 4 deletions src/components/table/OcTable.sort.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,28 +63,31 @@ describe("OcTable.sort", () => {
},
})
const headers = wrapper.findAll("thead th")
const headerButtons = wrapper.findAll("thead th button")
const th1 = headers.at(0)
const th2 = headers.at(1)
const th1Button = headerButtons.at(0)
const th2Button = headerButtons.at(1)

await th1.trigger("click")
await th1Button.trigger("click")
expect(th1.attributes("aria-sort")).toBe(DESC)
expect(th2.attributes("aria-sort")).toBe(NONE)
expect(wrapper.findAll("tbody tr td").at(0).text()).toBe("1245")
expect(wrapper.findAll("tbody tr td").at(1).text()).toBe("id-3")

await th1.trigger("click")
await th1Button.trigger("click")
expect(th1.attributes("aria-sort")).toBe(ASC)
expect(th2.attributes("aria-sort")).toBe(NONE)
expect(wrapper.findAll("tbody tr td").at(0).text()).toBe("111000234")
expect(wrapper.findAll("tbody tr td").at(1).text()).toBe("id-1")

await th2.trigger("click")
await th2Button.trigger("click")
expect(th1.attributes("aria-sort")).toBe(NONE)
expect(th2.attributes("aria-sort")).toBe(ASC)
expect(wrapper.findAll("tbody tr td").at(0).text()).toBe("1245")
expect(wrapper.findAll("tbody tr td").at(1).text()).toBe("id-3")

await th2.trigger("click")
await th2Button.trigger("click")
expect(th1.attributes("aria-sort")).toBe(NONE)
expect(th2.attributes("aria-sort")).toBe(DESC)
expect(wrapper.findAll("tbody tr td").at(0).text()).toBe("111000234")
Expand Down
1 change: 0 additions & 1 deletion src/components/table/OcTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
v-for="(field, index) in fields"
:key="`oc-thead-${field.name}`"
v-bind="extractThProps(field, index)"
@click.native="$emit(constants.EVENT_THEAD_CLICKED, field)"
>
<span
v-if="field.headerType === 'slot'"
Expand Down
4 changes: 0 additions & 4 deletions src/components/table/_OcTableCellHead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,5 @@ export default {
.oc-th {
color: var(--oc-color-text-muted);
font-weight: inherit;

&[aria-sort] {
cursor: pointer;
}
}
</style>
1 change: 1 addition & 0 deletions src/directives/OcTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const initOrUpdate = (el, { value = {} }, { elm }) => {
const props = merge.all([
{
ignoreAttributes: true,
interactive: true,
aria: {
content: null,
expanded: false,
Expand Down