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

Code audit #734

Open
8 of 17 tasks
Bookie0 opened this issue Nov 26, 2024 · 2 comments
Open
8 of 17 tasks

Code audit #734

Bookie0 opened this issue Nov 26, 2024 · 2 comments
Assignees

Comments

@Bookie0
Copy link
Collaborator

Bookie0 commented Nov 26, 2024

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.

    • For example, in the hero section of the home page, the "Courses" section, "Outreach" section, and "Team" section on this page could each be a <section> tag.
    • Or the cards in the "About" page could be <article> tags. (here)
    • The website footer should be <footer>
    • The navbar should be <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).

    • We should probably standardize this
  • 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

3. Alt text

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

  • We could perhaps make some values constants so that we our values are more consistent. And that way, if we have to update them, we only change it once.
  • Eg: here or here. In that 2nd link's case, if we're using slightly different values for similar icons, we should consider going back to the source image and editing that to make the dimensions the same.

6. Button/link labels

7. Misc

  • I don't think we need an extra <div> here? We could just apply the hidden attribute directly on the <a> I think. Makes for cleaner, simpler code, and also means we are using less <div> soup (lol)
@andrew032011 andrew032011 self-assigned this Nov 27, 2024
andrew032011 added a commit that referenced this issue Nov 29, 2024
### 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 -->
@andrew032011
Copy link
Collaborator

Same here; we use a <h3> even if the page is missing a <h2>

For this one, the MemberGroup is a component on the team page, which has an <h2> in the subheader above, so the <h3> wouldn't be considered skipping headers on the entire page.

@Bookie0
Copy link
Collaborator Author

Bookie0 commented Nov 30, 2024

For this one, the MemberGroup is a component on the team page, which has an <h2> in the subheader above, so the <h3> wouldn't be considered skipping headers on the entire page.

Ah I missed that, you're right! we can disregard that one then :)

andrew032011 added a commit that referenced this issue Dec 4, 2024
### 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 -->
andrew032011 added a commit that referenced this issue Dec 4, 2024
### 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 -->
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

No branches or pull requests

2 participants