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

Conversation

abailly-akamai
Copy link
Contributor

@abailly-akamai abailly-akamai commented Sep 19, 2023

Description 📝

Small PR to improve accessibility and markup on the Billing Detail page since those were bothering me and throwing warnings in the console.

Screenshot 2023-09-19 at 09 54 50

Major Changes 🔄

  • Provide accessibility to the back button link
  • Improve markup of the Download CVS Link
  • Update imports/exports

Preview 📷

This PR should contain no visual regression and should be tested against any.

How to test 🧪

Local Setup:
Pull and run code locally

Steps:

  1. Navigate to /account/billing/invoices/{invoiceId}
  2. Confirm there's no warning in the console about Link Accessibility
  3. Confirm there's no visual regression (no difference from the production page)
  4. Confirm the Download CSV link works as expected

@abailly-akamai abailly-akamai self-assigned this Sep 19, 2023
@abailly-akamai abailly-akamai marked this pull request as ready for review September 19, 2023 14:25
@abailly-akamai abailly-akamai requested a review from a team as a code owner September 19, 2023 14:25
@abailly-akamai abailly-akamai requested review from cliu-akamai and coliu-akamai and removed request for a team September 19, 2023 14:25
{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).

<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! 🎉

@@ -14,7 +14,7 @@ interface DownloadCSVProps {
data: unknown[];
filename: string;
headers: { key: string; label: string }[];
onClick: () => void;
onClick?: () => void;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like we still may need the onClick support on the MaintenanceTable component

@jdamore-linode
Copy link
Contributor

jdamore-linode commented Sep 19, 2023

Thanks for tackling this, @abailly-akamai !

Interestingly, even with the accessibleAriaLabel prop, when I use VoiceOver and focus on the "Back to Billing" link, it still gets announced generically as "visited link, billing, main". Navigating and activating the link via keyboard is also touchy; you can still focus the inner button, and when you "click" it via the enter key, it triggers the visual click animation but doesn't actually navigate you back to the billing page.

I'll attach screen recordings to M3-7155 momentarily which can probably do a better job explaining what I'm seeing

@bnussman-akamai bnussman-akamai changed the title fix: [fix-M3-7155] Link Accessibility & Markup on Billing Detail page fix: [M3-7155] Link Accessibility & Markup on Billing Detail page Sep 19, 2023
@bnussman-akamai bnussman-akamai changed the title fix: [M3-7155] Link Accessibility & Markup on Billing Detail page fix: [M3-7155] - Link Accessibility & Markup on Billing Detail page Sep 19, 2023
@abailly-akamai
Copy link
Contributor Author

@jdamore-linode thanks for that! the accessibleAriaLabel was not applied to the react-router-dom RouterLink. It is now, and i addressed the focusing issue. should be better now

Copy link
Contributor

@jdamore-linode jdamore-linode left a comment

Choose a reason for hiding this comment

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

@abailly-akamai Thanks, looks great! Confirmed that the label is announced by VoiceOver and that the focus/activation behavior when using keyboard navigation is fixed. Also pushed a quick test fix for the Download CSV and Download PDF buttons

Copy link
Contributor

@coliu-akamai coliu-akamai left a comment

Choose a reason for hiding this comment

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

🎉 Tested:

  • no console warnings for link accessibility
  • Download CSV link works as expected
  • voiceover sounded good for the back to billing link / included 'Back to billing' in the voiceover and other links/buttons
  • UI looks good (matches the develop branch -- prod doesn't have the Region column in the invoice table yet, so I didn't check against there)

@coliu-akamai coliu-akamai added the Approved Multiple approvals and ready to merge! label Sep 20, 2023
@abailly-akamai abailly-akamai merged commit 96ef76d into linode:develop Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants