Skip to content

Commit

Permalink
feat: add ARIA roles to month view (jquense#1863)
Browse files Browse the repository at this point in the history
Co-authored-by: Nmarinsiruela <[email protected]>
  • Loading branch information
Nmarinsiruela and Nmarinsiruela authored Feb 12, 2021
1 parent e797ab3 commit 02bbeb1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/DateContentRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class DateContentRow extends React.Component {
}

return (
<div className={className}>
<div className={className} role="rowgroup">
<BackgroundCells
date={date}
getNow={getNow}
Expand All @@ -175,6 +175,7 @@ class DateContentRow extends React.Component {
'rbc-row-content',
showAllEvents && 'rbc-row-content-scrollable'
)}
role="row"
>
{renderHeader && (
<div className="rbc-row " ref={this.createHeadingRef}>
Expand Down
2 changes: 1 addition & 1 deletion src/DateHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const DateHeader = ({ label, drilldownView, onDrillDown }) => {
}

return (
<a href="#" onClick={onDrillDown}>
<a href="#" onClick={onDrillDown} role="cell">
{label}
</a>
)
Expand Down
6 changes: 5 additions & 1 deletion src/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import PropTypes from 'prop-types'
import React from 'react'

const Header = ({ label }) => {
return <span>{label}</span>
return (
<span role="columnheader" aria-sort="none">
{label}
</span>
)
}

Header.propTypes = {
Expand Down
9 changes: 7 additions & 2 deletions src/Month.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ class MonthView extends React.Component {
this._weekCount = weeks.length

return (
<div className={clsx('rbc-month-view', className)}>
<div className="rbc-row rbc-month-header">
<div
className={clsx('rbc-month-view', className)}
role="table"
aria-label="Month View"
>
<div className="rbc-row rbc-month-header" role="row">
{this.renderHeaders(weeks[0])}
</div>
{weeks.map(this.renderWeek)}
Expand Down Expand Up @@ -160,6 +164,7 @@ class MonthView extends React.Component {
isOffRange && 'rbc-off-range',
isCurrent && 'rbc-current'
)}
role="cell"
>
<DateHeaderComponent
label={label}
Expand Down

0 comments on commit 02bbeb1

Please sign in to comment.