diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b3d6bb32..d44b6b8a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### ✨ New features/enhancements +- Made the graph's zoom, reset view and sidebar buttons keyboard and screen reader accessible (accessible names, visible focus outlines, and activation with Enter/Space) - Changed the colour of hybrid nodes to avoid a visual clash with the darkened background when selecting a focus - Updated section codes on the grid page to match the official timetable builder (listed as LEC/TUT/PRA instead of L/T/P) - Updated text on the course panel of the grid page to better communicate the panel's behaviour diff --git a/js/components/graph/Button.tsx b/js/components/graph/Button.tsx index 722df1678..d3426a0d7 100644 --- a/js/components/graph/Button.tsx +++ b/js/components/graph/Button.tsx @@ -3,10 +3,12 @@ import React from "react" interface ButtonProps { divId?: string mouseDown?: () => void + onClick?: () => void mouseUp?: () => void onMouseEnter?: () => void onMouseLeave?: () => void disabled?: boolean + ariaLabel?: string text?: string children?: React.ReactNode } @@ -14,10 +16,12 @@ interface ButtonProps { export default function Button({ divId, mouseDown, + onClick, mouseUp, onMouseEnter, onMouseLeave, disabled, + ariaLabel, text, children, }: ButtonProps) { @@ -26,10 +30,12 @@ export default function Button({ id={divId} className="graph-control-button" onMouseDown={mouseDown} + onClick={onClick} onMouseUp={mouseUp} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} disabled={disabled} + aria-label={ariaLabel} > {text} {children} diff --git a/js/components/graph/Graph.js b/js/components/graph/Graph.js index 9a1a8ce39..022a7ef03 100644 --- a/js/components/graph/Graph.js +++ b/js/components/graph/Graph.js @@ -1164,14 +1164,16 @@ export class Graph extends React.Component {