-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ (a11y) make time slider keyboard accessible #3162
Conversation
Warning Rate Limit Exceeded@sophiamersmann has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 54 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThe updates focus on enhancing accessibility and usability across several components of the Our World in Data Grapher. Changes include the shift from anchors to buttons for interactive elements, the addition of Changes
Related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (7)
- packages/@ourworldindata/grapher/src/controls/ActionButtons.tsx (1 hunks)
- packages/@ourworldindata/grapher/src/controls/ContentSwitchers.scss (3 hunks)
- packages/@ourworldindata/grapher/src/controls/ContentSwitchers.tsx (1 hunks)
- packages/@ourworldindata/grapher/src/controls/EntitySelectionToggle.tsx (1 hunks)
- packages/@ourworldindata/grapher/src/controls/SettingsMenu.tsx (1 hunks)
- packages/@ourworldindata/grapher/src/timeline/TimelineComponent.tsx (8 hunks)
- packages/@ourworldindata/grapher/src/timeline/TimelineController.ts (3 hunks)
Additional comments: 17
packages/@ourworldindata/grapher/src/controls/ContentSwitchers.scss (3)
- 27-27: The change from
<a>
to<button>
in CSS selectors is correct and aligns with accessibility improvements. Ensure that corresponding HTML changes are made in the components to match these selectors.- 72-72: The CSS selector update for active state from
<a>
to<button>
is appropriate and enhances semantic HTML use, contributing to better accessibility.- 108-108: The CSS change for padding adjustment in
.ContentSwitchers:not(.iconOnly) li > button
is consistent with the element change from<a>
to<button>
. This ensures styling consistency across different states of the component.packages/@ourworldindata/grapher/src/controls/EntitySelectionToggle.tsx (1)
- 85-85: Adding an
aria-label
attribute dynamically composed fromlabel.action
andlabel.entity
properties is a significant improvement for accessibility, making the button's purpose clear to screen reader users.packages/@ourworldindata/grapher/src/controls/ContentSwitchers.tsx (2)
- 83-83: The change from
<a>
to<button>
in theTab
component, along with the update to theonClick
event handler type, is a positive change for accessibility and semantic HTML. This aligns with best practices for interactive elements.- 89-96: Adding an
aria-label
to the button and updating thedata-track-note
attribute to include theprops.tab
value are good practices for accessibility and analytics. This ensures that the purpose of each tab is clear to all users and interactions can be tracked accurately.packages/@ourworldindata/grapher/src/timeline/TimelineController.ts (6)
- 68-70: The addition of the
getPrevTime
method is a logical extension of the timeline control functionality, allowing for more granular control over the timeline's start and end times through keyboard interactions.- 118-121: The
increaseStartTime
method correctly implements functionality to adjust the start time of the timeline forward, enhancing keyboard accessibility for the timeline component.- 123-126: The
decreaseStartTime
method provides a way to adjust the start time of the timeline backward using keyboard inputs, which is a necessary feature for full keyboard accessibility.- 128-131: The
increaseEndTime
method allows users to extend the end time of the timeline forward, which is crucial for users relying on keyboard navigation.- 133-136: The
decreaseEndTime
method enables users to move the end time of the timeline backward, ensuring that users can fully control the timeline through keyboard inputs.- 243-249: The methods
setStartToMax
andsetEndToMin
provide additional control over the timeline, allowing for quick adjustments to the timeline's bounds. This enhances the usability of the timeline component.packages/@ourworldindata/grapher/src/controls/ActionButtons.tsx (1)
- 350-350: Adding an
aria-label
attribute with the value ofprops.label
to theActionButton
component is a significant improvement for accessibility, ensuring that the purpose of each action button is clear to screen reader users.packages/@ourworldindata/grapher/src/controls/SettingsMenu.tsx (1)
- 424-424: Adding an
aria-label
attribute to the settings menu button is a good practice for accessibility, making the button's function clear to screen reader users.packages/@ourworldindata/grapher/src/timeline/TimelineComponent.tsx (3)
- 258-264: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [261-270]
Replacing a
<div>
with a<button>
for the timeline edge marker is a positive change for accessibility, as it makes the element interactive and accessible via keyboard. Ensure that corresponding CSS and event handlers are properly adjusted to maintain functionality.
- 282-293: The method
updateStartTimeOnKeyDown
correctly handles keyboard input for adjusting the start time of the timeline, which is essential for keyboard accessibility.- 295-306: The method
updateEndTimeOnKeyDown
provides functionality for adjusting the end time of the timeline through keyboard inputs, enhancing the component's accessibility.
packages/@ourworldindata/grapher/src/timeline/TimelineComponent.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Summary
Important limitation:
Other a11y improvements
<button />
when appropriate (instead of links or divs)Summary by CodeRabbit
aria-label
attributes.<a>
) tags to button (<button>
) tags in theContentSwitchers
component for better semantic HTML and accessibility.ActionButton
component to hide tooltips on mouse leave.ContentSwitchers
to apply styles to button elements instead of anchor tags.