-
Notifications
You must be signed in to change notification settings - Fork 2
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
Code audit #734
Comments
### Summary <!-- Required --> For the FAQ accordion [here](https://github.com/cornell-dti/idol/blob/e6b082a57fab1e1e4b414934c169fb5ce5d2caf6/new-dti-website/components/course/DDProjects.tsx#L33), we should use the `<details>` and `<summary>` tags. See this [MDN article for details](https://developer.mozilla.org/en-US/blog/html-details-exclusive-accordions/). ### Notion/Figma Link <!-- Optional --> Part of #734 ### Test Plan <!-- Required --> Verify FAQ Accordion looks and behaves the same as before. ### Notes <!-- Optional --> ### Breaking Changes <!-- Optional -->
For this one, the |
Ah I missed that, you're right! we can disregard that one then :) |
### Summary <!-- Required --> - Add Descriptive Aria Labels where appropriate - Add and revise alt text for images to be more descriptive ### Notion/Figma Link <!-- Optional --> Addresses problem 3 and problem 6 from #734. https://www.notion.so/Address-Code-Audit-Comments-14b0ad723ce1802fa2f0c633511d8de3?pvs=4 ### Test Plan <!-- Required --> No UI Changes expected. Grep through the code base for all instances of aria-label, alt, Image, img, button, and Link to ensure that the proper aria labels and alt texts are provided. ### Notes <!-- Optional --> <!--- List any important or subtle points, future considerations, or other items of note. --> ### Breaking Changes <!-- Optional -->
### Summary <!-- Required --> Ensure: - Each page has a `<h1>` tag (always the hero section only) - Don't skip over headers (i.e. every page now has `<h1>` for header, `<h2>` for subheader, and `<h3>` for headers below, and if there's a header below that, there's a `<h4>`. There aren't any usages of `<h5>`'s or `<h6>`'s anymore. There should be no difference in the UI from this change. ### Notion/Figma Link <!-- Optional --> Resolves problem 2 of #734. https://www.notion.so/Address-Code-Audit-Comments-14b0ad723ce1802fa2f0c633511d8de3?pvs=4 ### Test Plan <!-- Required --> Verify no UI changes are introduced by this change. Grep for `<h1>`, `<h2>`, `<h3>`, `<h4>`, `<h5>`, `<h6>` and ensure that it meets the standards mentioned above. ### Notes <!-- Optional --> <!--- List any important or subtle points, future considerations, or other items of note. --> ### Breaking Changes <!-- Optional -->
Hi team, here are a few issues i've found while poking through the code that we can fix to improve accessibility and maintainability of our code:
1. Proper tags
We should use more semantic HTML and use proper tags like
<section>
or<article>
instead of so many<div>
s.<section>
tag.<article>
tags. (here)<footer>
<nav>
(and the individual links should be<li>
list items within a<ul>
)I've noticed sometimes we use
<img>
(eg: here) and sometimes we use<Image>
(eg: here).I believe for FAQ accordions here, we should use the
<details>
and<summary>
tags. See this MDN article for more (New DTI Website: Use Details/Summary For FAQ Accordion #746)2. Headers
Each page should have a
<h1>
tag New Website: Ensure Proper Use of Headers #755Eg: in
page.tsx
over here, our highest header is only<h2>
And for example here, here, and then here, we're using
<h1>
several times. Ideally, only the hero section at the top of the page should include a<h1>
We shouldn't skip over headers New Website: Ensure Proper Use of Headers #755
In
bottom.tsx
over here, we use a<h5>
and then a<h6>
pretty randomly, skipping over a bunch of other headersSame here; we use a
<h3>
even if the page is missing a<h2>
3. Alt text
We don't need alt text for images that are decorative (but do still keep an explicit
alt=""
attribute) or that already have a label. New Website: Add Aria Labels and Better Alt Text #754Eg here, we already have the "LEARN MORE" label in the button, so the alt text on the
<img>
is redundantMany other instances of lacking
alt
text, like here or here inbottom.tsx
. And in many other instances throughout the website too New Website: Add Aria Labels and Better Alt Text #754Sometimes the issue isn't missing alt text, but unprecise alt text. In general, slightly more descriptive alt text would be nice. It's good practice to specify what this image is supposed to represent (which you do well here with "Trends icon"), but could be nice as well to also describe what you see visually (in this case something like "laptop") New Website: Add Aria Labels and Better Alt Text #754
Eg: here or here
New Website: Add Aria Labels and Better Alt Text #754
Like here or here, the image has a different alt text than its onscreen label
4. Random values
Seems like some values are sorta random.
We should try and use the standard Tailwind values
Eg: here
For colors, we should be using CSS variables to ensure consistency throughout our website
Eg: here or here
5. Making values constants
6. Button/link labels
7. Misc
<div>
here? We could just apply thehidden
attribute directly on the<a>
I think. Makes for cleaner, simpler code, and also means we are using less<div>
soup (lol)The text was updated successfully, but these errors were encountered: