Skip to content

Commit

Permalink
aria-pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Sep 29, 2021
1 parent 57c89a7 commit e0923c8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/common/src/ToolbarSection.tsx
Expand Up @@ -37,21 +37,23 @@ export class ToolbarSection extends BaseComponent<ToolbarSectionProps> {
<h2 className="fc-toolbar-title">{props.title}</h2>,
)
} else {
let buttonClasses = [`fc-${buttonName}-button`, theme.getClass('button')]
if (buttonName === props.activeButton) {
buttonClasses.push(theme.getClass('buttonActive'))
}

let isPressed = buttonName === props.activeButton
let isDisabled =
(!props.isTodayEnabled && buttonName === 'today') ||
(!props.isPrevEnabled && buttonName === 'prev') ||
(!props.isNextEnabled && buttonName === 'next')

let buttonClasses = [`fc-${buttonName}-button`, theme.getClass('button')]
if (isPressed) {
buttonClasses.push(theme.getClass('buttonActive'))
}

children.push(
<button
type="button"
title={typeof buttonTitle === 'function' ? buttonTitle(props.navUnit) : buttonTitle}
disabled={isDisabled}
aria-pressed={isPressed}
className={buttonClasses.join(' ')}
onClick={buttonClick}
>
Expand Down

0 comments on commit e0923c8

Please sign in to comment.