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

Accessibility - 3313 - Wrap abbreviations in <abbr> tag sitewide #5599

Merged
merged 28 commits into from
Feb 13, 2023

Conversation

yonikid15
Copy link
Contributor

🤖 Resolves #3313

👋 Introduction

The goal of this PR is to wrap all classification abbreviations in <abbr> tag, and add helper functions to make it easier from now on. After doing research it's important to "...use the element consistently throughout your web page. If you use an abbreviation in one part of the page, make sure to use the <abbr> element to define it, and provide the full expansion using the title attribute. This will help to ensure that the user has access to the full meaning of the acronym or abbreviation wherever it is used on the page". (https://webreference.com/html/tags/abbr/)

Talent Search Pages:

  • Homepage
  • Search
  • Request Page
  • Browse Opportunities
  • My Applications
  • View Pool advertisement
  • My Profile
  • Government Info Form

Admin:

  • Dashboard
  • Pools
  • Users* (Multi-Select input will be done in separate issue)
  • View User
  • Requests
  • View Request
  • All Candidates* (title in breadcrumbs not spacing correctly(??))
  • Classifications

IAP:

  • Homepage

🕵️ Details

There were a lot of changes to copy so I'm expecting some typos. Please be thorough in your review.

🧪 Testing

  • Go through the entire site and make sure all Abbreviations are wrapped in an <abbr> tag. They should have a dotted underline and show the full title when hovered over.
  • Ensure that AS classifications are read correctly on screen readers.

@petertgiles
Copy link
Contributor

@mnigh Does adding the abbreviations scramble the MacOS Voiceover even more?

Copy link
Contributor

@petertgiles petertgiles left a comment

Choose a reason for hiding this comment

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

Works great, looks great! A few things to check on but it looks almost done.

apps/web/src/components/SelfDeclaration/HelpLink.tsx Outdated Show resolved Hide resolved
title?: string,
): JSX.Element => {
const stringifyText = text && text.toString(); // grabs text from React.ReactNode (is there a better way to get text from React.ReactNode type?)
if (typeof stringifyText !== "string") {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd recommend logging a warning message if this happens.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you use the logger in frontend/common/src/hooks/useLogger.ts instead of console? This will allow us to log other places, like Azure AppInsights, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, I can't use the useLogger hook since wrapAbbr() isn't a component or hook function. It looks like for most of these "message" functions we have a fallback string, so I used that. I removed the console warning's and made sure all edge cases display that title. I made the changes here 78adc9d

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that works OK. If you do need to use the logger outside a component you can import the logger directly instead of using the hook, like in frontend/common/src/components/Auth/AuthenticationContainer.tsx .

apps/web/src/lang/fr.json Show resolved Hide resolved
frontend/common/src/helpers/nameUtils.tsx Outdated Show resolved Hide resolved
</abbr>
);
default:
return (
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe worth logging a warning here, too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you use the logger in frontend/common/src/hooks/useLogger.ts instead of console? This will allow us to log other places, like Azure AppInsights, for example.

frontend/common/src/lang/fr.json Show resolved Hide resolved
@mnigh
Copy link
Contributor

mnigh commented Feb 6, 2023

@mnigh Does adding the abbreviations scramble the MacOS Voiceover even more?

@petertgiles not sure about scrambling abbreviations up (do we mean this?), but it does some weird stuff. for example, have a look at how it reads the Group and Level chip. @esizer does this seem correct to you?

Screen Recording

pools.mov

Copy link
Contributor

@mnigh mnigh left a comment

Choose a reason for hiding this comment

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

Nice start @yonikid15! This is definitely a difficult issue.

Screenshots

This group value is missing abbreviations, though maybe this is not possible since its value comes from an open text field?
Screen Shot 2023-02-06 at 18 38 01

The entire IT-01 is part of the abbr instead of just IT.
Screen Shot 2023-02-06 at 18 28 16

Missing abbreviations (GC and CIO in the following screenshot but more throughout the project)
Screen Shot 2023-02-06 at 18 40 40

@esizer
Copy link
Member

esizer commented Feb 7, 2023

@esizer does this seem correct to you?

The chip seems to be a little verbose but other than that it seems okay. Maybe we could drop the "Information Technology" off of the chip? I was talking with @yonikid15 about this and think we need a page that displays definitions for all of the acronyms. They are not very intuitive for non-government people and could be valuable.

@mnigh
Copy link
Contributor

mnigh commented Feb 7, 2023

Reasons not to use abbreviations in page titles or headings:

Screen Shot 2023-02-07 at 09 33 33

@yonikid15
Copy link
Contributor Author

Nice start @yonikid15! This is definitely a difficult issue.

Screenshots

This group value is missing abbreviations, though maybe this is not possible since its value comes from an open text field?

Oh sorry, no for this one specifically Rosalie said it's not necessary since the abbreviation title is next to it.

The entire IT-01 is part of the abbr instead of just IT.

Since we want the screen reader to ready I T 1 or A S 4 the entire group and level were added to the abbreviation. Otherwise it would read out "I T minus 0 1" or "A S minus 0 4". Unless you know of a better solution. Ideally we get rid of the "-0" throughout the site, but I'm not sure if that's possible.

Missing abbreviations (GC and CIO in the following screenshot but more throughout the project) Screen Shot 2023-02-06 at 18 40 40

Oh great thanks! I'll add these in.

Copy link
Contributor

@petertgiles petertgiles left a comment

Choose a reason for hiding this comment

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

Looking great. Almost done!

@yonikid15 yonikid15 merged commit eb1abe5 into main Feb 13, 2023
@yonikid15 yonikid15 deleted the accessibility/3313-wrap-abbreviations-sitewide branch February 13, 2023 19:13
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.

Screen readers read out abbreviations as words
4 participants