-
Notifications
You must be signed in to change notification settings - Fork 0
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
Website 38 investigate adding the ability to navigate via calendar in hours view #319
Website 38 investigate adding the ability to navigate via calendar in hours view #319
Conversation
…ate-adding-the-ability-to-navigate-via-calendar-in-Hours-View
added calendar expansion on clicking date range heading. Now I need to get the calendar view fixed under the heading, clean up the code, remove the repeated component, and see if we can sticky it on scroll.
moved the previous / next week component to its own component file and render it once at the top of the hours view versus multiple times at the top of each hours location. Also made the component sticky.
made the background color match the maize used throughout the rest of the interface and moved the sticky up 1px so there's not a gap.
…to-navigate-via-calendar-in-Hours-View
…to-navigate-via-calendar-in-Hours-View
User can now select week from calendar view, changed the previous and next week button to a link, added conditional highlighting for border of week.
next / previous week now changes month if moving to a different month. Selecting a week in a different month no longer selects the week index of the current month.
…to-navigate-via-calendar-in-Hours-View
Renamed the file to coincide with naming convention for panels. Added accessibility and keyboard navigation to calendar view. Updated the days positioning (sun, mon, tue, etc.) to better align with the columns.
…ia-calendar-in-Hours-View' of https://github.com/mlibrary/lib.umich.edu into WEBSITE-38-Investigate-adding-the-ability-to-navigate-via-calendar-in-Hours-View
Changed background color for calendar and working on consolidating actions.
refactored common logic into single utility function.
added esc close and instructions.
Moved the isVisible up to encapsulate entire calendar component.
accessibility updates for table view.
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.
Thanks for taking the time to review! I've made all the suggested changes. Since your last review, Emma and Heidi got some user feedback and we made two more UI edits. I'll mark those so you don't have to review all the code again. Thanks again!
> | ||
<div | ||
css={{ | ||
alignItems: 'center', |
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.
center aligned all items in the HoursPanelNextPrev component
<div | ||
key={dayIndex} | ||
css={{ | ||
backgroundColor: getColorBasedOnDate(day), |
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.
I was dynamically setting the color here if the day didn't fall in the current month. UX team found the color wasn't accessible on gold background (which is the case for last / first week of month if there are overlapping days. The suggestion was to make all the numbers the same color so that rule is now gone.
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.
This looks great! I have done accessibility testing, and there are two blockers:
- ✅ Everything works with keyboard and mouse.
- ❔ NOT A BLOCKER! I did VoiceOver testing and this is more of a question for Ben and Bridget on how descriptive should this be:
- For the previous/next week/month buttons, they say the text. Would it be worth to voice what the next week or month the user will be moved into?
- Have you thought about trying to use the
details
element? I believe the open/close voicing is natively baked in.
- ❌ The
esc to close
text color does not have a high enough contrast. - ❌ ARC Toolkit gave out this error:
ARIA attribute is not allowed
and this warning:Missing href
. I believe these can be resolved in two ways:- Continue using the anchor element, and add an empty
href
attribute, and move thearia-label
value inside the anchor and wrap it in aspan.visually-hidden
element. You make also need to addaria-hidden
to the days of the week so they're not voiced. - Change the anchor to a button.
- Continue using the anchor element, and add an empty
You're almost there!
we definitely want to announce changes to the label when prev / next week are selected
The esc key wasn't announcing the calendar close state. This fixes that and removes some redundant logic along the way.
Thanks again! I made quite a few changes but I'll summarize here:
|
…to-navigate-via-calendar-in-Hours-View
@@ -316,7 +316,7 @@ const CalendarView = ({ isVisible, weekOffset }) => { | |||
return weekStartDay.getTime() === viewedWeekStartDay.getTime(); | |||
}); | |||
return ( | |||
<a | |||
<button |
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.
@erinesullivan This worked quite well in NVDA. I'm curious if it's still functional and makes sense with VoiceOver.
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.
👍🏻 The accessibility issues have been resolved! This looks great.
Overview
Users can only navigate one week a time on the Hours View, which makes it tedious to look further ahead.
This PR adds a calendar component to the hours view (deploy URL). The calendar component provides a singular component to give the user the ability to navigate by weeks while also having a monthly calendar display.
The calendar is a sticky header component that scrolls with the user. The previous implementation of having a previous / next week component for each section caused a significant amount of visual information. Hopefully this alleviates some of that.
ChatGPT helped write some of the algorithms for comparing JS
Date
objects, since those aren't always super intuitive. I gave it all an additional pass to clean up / combine logic and make it more human legible.Anything else?
As part of this work, I was exploring anchor links since the hours view is the only page we support anchor links. For example: https://deploy-preview-319--future-wwwlib-previews.netlify.app/locations-and-hours/hours-view#art-architecture-and-engineering-library
We handle anchor links in the
gatsby-browser
file. I extended the function to offset the anchor position by the height of the sticky header.I also explored fixing the tab order for anchor links. In essence, when a user gets to a page via an anchor link, I want the anchored element to receive focus. Instead of trying to explore that issue within this PR, I broke it out into a separate ticket.
Testing
List instructions on how to test the pull request. Some examples: