Skip to content

Conversation

@ChristopherChudzicki
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki commented Aug 27, 2024

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/5242

Description (What does it do?)

Adds better headings to our pages.

Screenshots (if appropriate):

Home / Search

Screenshot 2024-08-28 at 4 06 40 PM Screenshot 2024-08-28 at 4 11 00 PM

Unit / Department / Topic Channel

Screenshot 2024-08-28 at 4 06 28 PM Screenshot 2024-08-28 at 4 11 28 PM Screenshot 2024-08-28 at 4 11 51 PM

Unit / Department / Topics / Listing
Screenshot 2024-08-28 at 4 12 13 PMScreenshot 2024-08-28 at 4 06 13 PMScreenshot 2024-08-28 at 4 12 35 PM

About Us / Privacy

Screenshot 2024-08-28 at 4 13 41 PM Screenshot 2024-08-28 at 4 13 57 PM

How can this be tested?

Check that:

  1. There are no visible changes to the site. There shouldn't be... if you notice any, it is unintential.
  2. The headings on each page make sense. Some ways you could view the headings:
    • HeadingsMap extension... Chrome ... I think it exists for other browsers, too
    • Or use a screenreader like MacOS Voiceover. With Voiceover, VO + U (where VO = voiceover key combo) opens the "Rotor". Then arrow keys nav to the headings navigation section.

@ChristopherChudzicki ChristopherChudzicki changed the title Cc/headings Better Headings Structure Aug 27, 2024
Comment on lines +150 to +154
h1: "span",
h2: "span",
h3: "span",
h4: "span",
h5: "span",
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 to prevent accidental future headings.

In general, our h1...h5 font variant may not correspond to an h1...h5 header, which was the old behavior.

`

const Title = styled.h3<{ lines?: number; size?: Size }>`
const Title = styled.span<{ lines?: number; size?: Size }>`
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, and a similar change to ListCard, broke a lot of tests. (A downside of testing roles). Thats accounts for a lot of the changed files.

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 file was unused. It was our old (pre-professional designs) card template.

disableEnforceFocus={disableEnforceFocus}
PaperProps={PaperProps}
TransitionComponent={Transition}
aria-labelledby={titleId}
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 was an issue I noticed while looking at accessibility stuff. Previously MUI did this for us, but when we stopped using their DialogTitle component, we lost the automatic id assignment.

Comment on lines -354 to -358
screen.findByRole("tab", { name: tab }).then(async (featuredTab) => {
await user.click(within(featuredTab).getByRole("tab", { name: tab }))
const [featuredPanel] = screen.getAllByRole("tabpanel")
await within(featuredPanel).findByText(resources.results[0].title)
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to just remove this test. It was broken and not adding much value, IMO. Testing the behavior of the resource carousel (clicking tabs, etc) is pretty well covered in ResourceCarousel.test.tsx

How it was broken: screen.findByRole("tab", ... at the end here is a promise and it was not being awaited.

  • if you insert an await here you'll see the test fails on main
  • Usually un-awaited asynchronous assertions can cause artificial failures on subsequent async tests in the same file, but since this was the last test with any awaits, we weren't noticing any.

@ChristopherChudzicki ChristopherChudzicki marked this pull request as ready for review August 28, 2024 20:55
@gumaerc gumaerc self-assigned this Aug 29, 2024
@ChristopherChudzicki ChristopherChudzicki added the Needs Review An open Pull Request that is ready for review label Aug 29, 2024
Copy link
Contributor

@gumaerc gumaerc left a comment

Choose a reason for hiding this comment

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

👍

This looks good. I checked out as many pages as I could using HeadingsMap and the flow on every page looks a lot more logical.

@ChristopherChudzicki ChristopherChudzicki merged commit d4a0cc0 into main Aug 29, 2024
@odlbot odlbot mentioned this pull request Aug 29, 2024
2 tasks
@odlbot odlbot mentioned this pull request Aug 30, 2024
4 tasks
@rhysyngsun rhysyngsun deleted the cc/headings branch February 7, 2025 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants