Skip to content

Commit

Permalink
Set aria-sort attribute on vTH
Browse files Browse the repository at this point in the history
Accessibility enhancement. Adds the `aria-sort` attribute to the
`th` elements rendered by VTH component. Valid labels are "none",
"ascending", and "descending".

https://w3c.github.io/aria-practices/examples/grid/dataGrids.html
  • Loading branch information
bryanbuchs committed Jan 4, 2021
1 parent 2e06d84 commit 6ca534e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/VTh.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default {
id: uuid(),
order: 0,
orderClasses: ['vt-desc', 'vt-sortable', 'vt-asc'],
ariaLabels: ['descending', 'none', 'ascending'],
state: this.store._data
}
},
Expand All @@ -58,6 +59,9 @@ export default {
},
sortClass () {
return this.state.hideSortIcons ? [this.orderClasses[this.order + 1], 'vt-sort'] : []
},
ariaSortLabel () {
return this.ariaLabels[this.order + 1]
}
},
watch: {
Expand Down

0 comments on commit 6ca534e

Please sign in to comment.