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
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b38b56e
Wrap all abbreviations sitewide with wrapAbbr() helper function
yonikid15 Feb 3, 2023
dab0f3b
Update getFullfullPoolAdvertisementTitle in poolUtils with abbr wrapp…
yonikid15 Feb 3, 2023
405e18f
Fix wrapAbbr ariaLabel
yonikid15 Feb 3, 2023
dadbe22
Update all poolAdvertisement titles with updated helper function
yonikid15 Feb 3, 2023
6e3a68f
Merge branch 'main' into accessibility/3313-wrap-abbreviations-sitewide
yonikid15 Feb 3, 2023
1e56b90
Fix poolUtils tests
yonikid15 Feb 3, 2023
706cd9c
Add aria-label to span instead of abbr
yonikid15 Feb 3, 2023
231d53f
Merge branch 'main' into accessibility/3313-wrap-abbreviations-sitewide
yonikid15 Feb 3, 2023
537023d
Update old poolAdvertisement title helper
yonikid15 Feb 3, 2023
468e0fb
Miscellaneous fixes to breaking tests
yonikid15 Feb 4, 2023
8d0c97a
Merge branch 'main' into accessibility/3313-wrap-abbreviations-sitewide
yonikid15 Feb 4, 2023
782191e
Fix translation
yonikid15 Feb 4, 2023
f8a7195
Merge branch 'main' into accessibility/3313-wrap-abbreviations-sitewide
yonikid15 Feb 8, 2023
cd6190e
Fix relative path imports
yonikid15 Feb 8, 2023
24598c9
Add logging warning if string is not passed to abbreviation rich text…
yonikid15 Feb 8, 2023
36b9818
Add splitAndJoin utility function
yonikid15 Feb 8, 2023
4813b35
Add warning to wrapAbbr if abbr title is missing
yonikid15 Feb 8, 2023
30a69f3
Wrap rest of abbreviations in abbr tag
yonikid15 Feb 8, 2023
493db33
Merge branch 'main' into accessibility/3313-wrap-abbreviations-sitewide
yonikid15 Feb 8, 2023
2a29516
Fix e2e tests
yonikid15 Feb 9, 2023
cdd3840
Fix more relative path imports
yonikid15 Feb 9, 2023
86102a7
Fix translations
yonikid15 Feb 9, 2023
164fcae
Merge branch 'main' into accessibility/3313-wrap-abbreviations-sitewide
yonikid15 Feb 9, 2023
ec7eac0
fix auth e2e test
yonikid15 Feb 9, 2023
355afa4
Merge branch 'main' into accessibility/3313-wrap-abbreviations-sitewide
yonikid15 Feb 10, 2023
4d2fa8f
Fix message with CIO abbreviation
yonikid15 Feb 10, 2023
7a13eba
Merge branch 'main' into accessibility/3313-wrap-abbreviations-sitewide
yonikid15 Feb 13, 2023
78adc9d
Ensure fallback title is used for edge cases
yonikid15 Feb 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import ApplicationNavigation, {

export interface ApplicationPageWrapperProps {
title: string;
subtitle?: string;
subtitle?: React.ReactNode;
crumbs?: BreadcrumbsProps["crumbs"];
navigation?: ApplicationNavigationProps;
closingDate: PoolAdvertisement["closingDate"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import SaveButton from "./SaveButton";

export interface ProfileFormWrapperProps {
crumbs: BreadcrumbsProps["crumbs"];
description?: string;
description?: React.ReactNode;
title: string;
metaTitle?: string; // Used to override <head><title /></head>
children?: React.ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getLocalizedName } from "@common/helpers/localize";
import { getPoolCandidateSearchStatus } from "@common/constants/localizedConstants";
import { PoolCandidateSearchStatus } from "@common/api/generated";
import Pending from "@common/components/Pending";
import { getFullPoolAdvertisementTitle } from "@common/helpers/poolUtils";
import { getFullPoolAdvertisementTitleHtml } from "@common/helpers/poolUtils";
import { formatDate, parseDateTimeUtc } from "@common/helpers/dateUtils";

import {
Expand Down Expand Up @@ -58,6 +58,7 @@ function poolsAccessor(
const pools =
row.original?.applicantFilter?.pools ??
row.original?.poolCandidateFilter?.pools;

const filteredPools = pools?.filter(notEmpty);
return filteredPools?.length ? (
<span>
Expand All @@ -66,7 +67,7 @@ function poolsAccessor(
pool && (
<React.Fragment key={pool.id}>
<a href={paths.poolCandidateTable(pool.id)}>
{getFullPoolAdvertisementTitle(intl, pool)}
{getFullPoolAdvertisementTitleHtml(intl, pool)}
</a>
{index > 0 && ", "}
</React.Fragment>
Expand All @@ -87,8 +88,8 @@ export const SearchRequestTable = ({
const paths = useRoutes();

const localizedTransformPoolToPosterTitle = useCallback(
(pool: Parameters<typeof getFullPoolAdvertisementTitle>[1]) =>
getFullPoolAdvertisementTitle(intl, pool),
(pool: Parameters<typeof getFullPoolAdvertisementTitleHtml>[1]) =>
getFullPoolAdvertisementTitleHtml(intl, pool),
[intl],
);

Expand Down
6 changes: 4 additions & 2 deletions apps/web/src/components/SelfDeclaration/HelpLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import { useIntl } from "react-intl";
import { wrapAbbr } from "~/../../../frontend/common/src/helpers/nameUtils";
petertgiles marked this conversation as resolved.
Show resolved Hide resolved

const contactLink = (chunks: React.ReactNode) => (
<a
Expand All @@ -16,14 +17,15 @@ const HelpLink = () => {
<p>
{intl.formatMessage(
{
id: "YZ/ZhG",
id: "pIiisf",
defaultMessage:
"If you are unsure about providing your information, or if you have any questions regarding the IT Apprenticeship Program for Indigenous Peoples, please <link>contact us</link> and we would be happy to meet with you.",
"If you are unsure about providing your information, or if you have any questions regarding the <abbreviation>IT</abbreviation> Apprenticeship Program for Indigenous Peoples, please <link>contact us</link> and we would be happy to meet with you.",
description:
"Text describing where to get help with the self-declaration form",
},
{
link: contactLink,
abbreviation: (text: React.ReactNode) => wrapAbbr(text, intl),
},
)}
</p>
Expand Down
20 changes: 13 additions & 7 deletions apps/web/src/components/SelfDeclaration/SignAndContinue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useFormContext } from "react-hook-form";
import { Input, Submit } from "@common/components/form";
import { FieldLabels } from "@common/components/form/BasicForm";
import errorMessages from "@common/messages/errorMessages";
import { wrapAbbr } from "~/../../../frontend/common/src/helpers/nameUtils";

interface SignAndContinueProps {
labels: FieldLabels;
Expand Down Expand Up @@ -89,13 +90,18 @@ const SignAndContinue = ({ labels }: SignAndContinueProps) => {
<Submit
color="ia-primary"
mode="solid"
text={intl.formatMessage({
defaultMessage:
"Explore IT opportunities within the federal government",
id: "32qwlv",
description:
"Button text to submit the Indigenous self-declaration form when not Indigenous.",
})}
text={intl.formatMessage(
{
defaultMessage:
"Explore <abbreviation>IT</abbreviation> opportunities within the federal government",
id: "j3WBqJ",
description:
"Button text to submit the Indigenous self-declaration form when not Indigenous.",
},
{
abbreviation: (text: React.ReactNode) => wrapAbbr(text, intl),
},
)}
/>
</p>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { enumToOptions } from "@common/helpers/formUtils";
import { notEmpty } from "@common/helpers/util";
import useLocale from "@common/hooks/useLocale";
import { commonMessages } from "@common/messages";
import { getFullPoolAdvertisementTitle } from "@common/helpers/poolUtils";
import { getFullPoolAdvertisementTitleLabel } from "@common/helpers/poolUtils";

import {
WorkRegion,
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function useFilterOptions(enableEducationType = false) {
const optionsData = {
pools: filterRes.data?.pools.filter(notEmpty).map((pool) => ({
value: pool.id,
label: getFullPoolAdvertisementTitle(intl, pool),
label: getFullPoolAdvertisementTitleLabel(intl, pool),
})),
languageAbility: enumToOptions(LanguageAbility).map(({ value }) => ({
value,
Expand Down
19 changes: 13 additions & 6 deletions apps/web/src/hooks/useQuote.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
import React from "react";
import { useIntl } from "react-intl";
import { wrapAbbr } from "~/../../../frontend/common/src/helpers/nameUtils";

export interface Quote {
content: React.ReactNode | string;
author: string;
author: string | React.ReactNode;
}

const useQuote = (): Quote => {
const intl = useIntl();

const quotes: Quote[] = [
{
author: intl.formatMessage({
defaultMessage: "Government of Canada IT Apprentice",
id: "49UIne",
description: "author of testimonial number one",
}),
author: intl.formatMessage(
{
defaultMessage:
"Government of Canada <abbreviation>IT</abbreviation> Apprentice",
id: "pRGDLn",
description: "author of testimonial number one",
},
{
abbreviation: (text: React.ReactNode) => wrapAbbr(text, intl),
},
),
content: intl.formatMessage(
{
defaultMessage:
Expand Down
Loading