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

fix: [M3-7155] - Link Accessibility & Markup on Billing Detail page #9697

Merged
merged 6 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
26 changes: 15 additions & 11 deletions packages/manager/src/components/DownloadCSV/DownloadCSV.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,24 @@ export const DownloadCSV = ({
text = 'Download CSV',
}: DownloadCSVProps) => {
return (
<>
<CSVLink
aria-hidden="true"
className={className}
data={cleanCSVData(data)}
filename={filename}
headers={headers}
ref={csvRef}
<CSVLink
className={className}
data={cleanCSVData(data)}
filename={filename}
headers={headers}
ref={csvRef}
>
<Button
buttonType={buttonType}
component="span"
disableRipple
onClick={onClick}
sx={sx}
tabIndex={-1}
/>
<Button buttonType={buttonType} onClick={onClick} sx={sx}>
>
{text}
</Button>
</>
</CSVLink>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we use the CSV link as the accessible element rather than the button. (also, downloads are semantically links with href)

Rendering the as a span is a decent way to keep the styling identical while being semantically correct (buttons are not permitted within <a> tags)

Content model: Transparent, but there must be no interactive content descendant.

The a element may be wrapped around entire paragraphs, lists, tables, and so forth, even entire sections, so long as there is no interactive content within (e.g. buttons or other links).

);
};

Expand Down
6 changes: 5 additions & 1 deletion packages/manager/src/features/Account/AccountLanding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ import { useGrants } from 'src/queries/profile';

import AccountLogins from './AccountLogins';

const Billing = React.lazy(() => import('src/features/Billing'));
const Billing = React.lazy(() =>
import('src/features/Billing/BillingDetail').then((module) => ({
default: module.BillingDetail,
}))
);
const EntityTransfersLanding = React.lazy(() =>
import(
'src/features/EntityTransfers/EntityTransfersLanding/EntityTransfersLanding'
Expand Down
6 changes: 4 additions & 2 deletions packages/manager/src/features/Account/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { SuspenseLoader } from 'src/components/SuspenseLoader';
const AccountLanding = React.lazy(
() => import('src/features/Account/AccountLanding')
);
const InvoiceDetail = React.lazy(
() => import('src/features/Billing/InvoiceDetail')
const InvoiceDetail = React.lazy(() =>
import('src/features/Billing/InvoiceDetail/InvoiceDetail').then((module) => ({
default: module.InvoiceDetail,
}))
);
const EntityTransfersCreate = React.lazy(() =>
import(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,18 @@ export const InvoiceDetail = () => {
>
<Grid container rowGap={2}>
<Grid xs={12}>
<Grid container spacing={2} sx={sxGrid} data-qa-invoice-header>
<Grid container data-qa-invoice-header spacing={2} sx={sxGrid}>
<Grid sm={4} sx={sxGrid} xs={12}>
<Link to={`/account/billing`} data-qa-back-to-billing>
<Link
accessibleAriaLabel="Back to Billing"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the missing tag/accessibility support causing the console error:

https://github.com/linode/manager/blob/develop/packages/manager/src/components/Link.tsx#L83-L88

It works! 🎉

data-qa-back-to-billing
to={`/account/billing`}
>
<IconButton
sx={{
padding: 0,
}}
component="span"
size="large"
>
<KeyboardArrowLeft
Expand Down Expand Up @@ -246,5 +251,3 @@ export const InvoiceDetail = () => {
</Paper>
);
};

export default InvoiceDetail;

This file was deleted.

1 change: 0 additions & 1 deletion packages/manager/src/features/Billing/index.tsx

This file was deleted.