Skip to content
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

Corina/644 fix a11y picks page #656

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from

Conversation

CorinaMurg
Copy link
Contributor

@CorinaMurg CorinaMurg commented Nov 13, 2024

Accessibility issues on the Picks Page

Fixed with this PR:

  • separate each game into a radio group (to help screen reader users understand which teams are playing against each other)
  • add focus outline to each radio button
  • add sr-only text to name the pick for each week in the previous weeks' section
  • add an empty alt to the logos in the previous weeks section
  • add an empty alt to the logo for each radio button (an alt text is redundant here since each button already has a label)
  • add dynamic value to the htmlFor attribute of each radio button's outer label

Closes #644

PS To test with a keyboard, press tab to navigate through the interactive controls:

  • tab (or Shift + tab) will allow you to move from one radio group to the next/previous. In order to select the team, press the Space bar
  • use an arrow key to move focus to the other team in the game. As expected with a radio group, this will also trigger selection of that button (so no need to press Space bar this time!). Because on this page selection triggers submission to the server, you should see a status message and will be sent to the All Entries page.

Copy link

appwrite bot commented Nov 13, 2024

Gridiron Survivor Application 6616ea581ef9f5521c7d

Function ID Status Action
Your function has been successfully deployed.

Project name: Gridiron Survivor Application
Project ID: 6616ea581ef9f5521c7d

Function ID Status Action
userAuth 6626fef885a9f630442b ready Ready View Logs

Only deployments on the production branch are activated automatically. If you'd like to activate this deployment, navigate to your deployments. Learn more about Appwrite Function deployments.

💡 Did you know?
Appwrite has a Discord community with over 16 000 members. Come join us!

Copy link

vercel bot commented Nov 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gridiron-survivor ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 20, 2024 4:05am
gridiron-survivor-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 20, 2024 4:05am

@@ -41,8 +41,11 @@ export interface IWeeklyPicks {
gameWeekId: string;
userResults: IUserPicksData;
}
// Currently, the pick history section on the
// Picks page uses this interface without requiring the teamId. Future
// accessibility fixes will most likely make use of the teamId.
export interface INFLTeam {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What else uses INFLTeam? Making this optional will cause Type issues down the long wrong. I'd suggest you keep this intact, create a new interface that extends INFLTeam and makes teamId required for the code that is using teamId as a requirement.

@@ -43,7 +44,7 @@ import Heading from '@/components/Heading/Heading';
*/
// eslint-disable-next-line no-unused-vars
const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => {
const [pickHistory, setPickHistory] = useState<string[]>([]);
const [pickHistory, setPickHistory] = useState<INFLTeam[]>([]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done!

let entryHistory = currentEntry?.selectedTeams || [];
const entryHistory = currentEntry?.selectedTeams || [];

let entryHistoryObject: INFLTeam[] = [];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is redundant because getPickHistory is only ran once. Therefore, the default value on line 47 should suffice. There's no need to resave an empty array if it's already the default value. It will cause unnecessary re-renders.

@@ -160,15 +161,18 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => {
}

setEntryName(currentEntry.name);
let entryHistory = currentEntry?.selectedTeams || [];
const entryHistory = currentEntry?.selectedTeams || [];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this function need to be refactored for this ticket?

Copy link
Contributor Author

@CorinaMurg CorinaMurg Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashilo
Previously, we only stored URLs for team logos in the pickHistory state. But we need to hold on to the team name as well to use it as the alt text of the image. That's why the entryHistoryObject.

@@ -291,14 +295,14 @@ const Week = ({ entry, league, NFLTeams, week }: IWeekProps): JSX.Element => {
className="flex flex-wrap w-[90%] gap-4 overflow-x-scroll justify-center pb-10 items-center"
data-testid="user-pick-history"
>
{pickHistory?.map((logoURL, index) => {
{pickHistory?.map((team, index) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to refactor this code for this ticket?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shashilo
The alt text for each logo used to be hardcoded as "team logo". We needed a way to assign it a dynamic value, ie the team's name.

hasTeamBeenPicked(competition.team.name, selectedTeams)
}
isDisabled={false}
// isDisabled={
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix the accessibility issues on the picks page
2 participants