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

Make h1 hold full title while maintaining formatting #531

Conversation

milofultz
Copy link
Contributor

Part of PR 516.

This puts the whole heading and subheading within the h1, maintaining formatting and visuals.

Screen Shot 2023-11-16 at 8 45 23 PM Screen Shot 2023-11-16 at 8 45 19 PM

@milofultz milofultz changed the base branch from Development to issue-456/home-page-structure-enhancements November 17, 2023 04:51
@@ -35,6 +35,7 @@
"@mui/material": "^5.12.2",
"@mui/styled-engine-sc": "^5.12.0",
"@mui/system": "^5.12.1",
"@mui/utils": "^5.14.18",
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this additional dependency? I can't find any documentation on it.

The npm repo makes it look like it may be private: https://www.npmjs.com/package/@mui/utils

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 what MUI recommended for screen-reader-only text: https://mui.com/system/screen-readers/

Turns out the dep is already in there (check out package lock), so this isn't actually much extra for the bundle

<Stack component="span" justifyContent="center" alignItems="center" spacing={2} mb={2}>
<Typography variant="h1" component="span" fontWeight="500" fontSize="72px">
{heading}
{punctuation}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not quite sure I understand what this punctuation is doing. Could you describe it a bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The punctuation is largely just a nice thing for screen reader users, so when they get to the h1, they don't hear "PASS Personal Access..." as all one sentence. The colon will usually provide a pause between "PASS" and "Personal...". Otherwise, assistive technologies may say "colon" literally, which is also descriptive.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to achieve this effect without writing screen reader specific code? Maybe wrap the section in a header tag and wrap the subtitle in a p element? https://mikebifulco.com/posts/semantic-html-heading-subtitle#use-this-code-to-add-subtitles-to-headings

PASS is volunteer-driven, and it doesn't have the resources to test PRs in multiple display environments. It's already a challenge to fully test our app in both desktop and mobile setups, so we can't guarantee that screen reader code will ever be validated, or maintained.

The ideal would be code that is fully agnostic to the display environment, and functions comparably in all environments. That way, a visual validation in the most recent version of Chrome can make us reasonably confident of the app's behavior in JAWS and NVDA. It's also easier to write automated tests for that kind of code.

I'm 100% on board with making PASS more usable for screen readers. We just need to do it in a way that's maintainable for a project this size. It's kind of a fun design challenge :)

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 hear you on maintainability. This code may not be the best solution (likely), but as you said, more maintainable and accessible solutions may require some significant changes elsewhere, when dealing with issues in the future.

As for the h1/p suggestion, the text to be rendered needs to be within the h1 for it to be presented to the screen reader. If someone hears “PASS”, it doesn’t actually say what it is.

Another way would be leaving “PASS” out of the h1 and only containing the expanded acronym in the h1. Might be a bit cleaner overall.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All this being said, I could leave some comments explaining the purposes of these elements.

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 cleaned it up a little and added a comment there. Happy to try something else, too, but this should be fairly simple to maintain, I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

@timbot1789

when you have a chance to re-look at this...

this PR is stalling #516

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be ok then. I think it would be good to go over accessibility standards with the project team at some point.

@milofultz do you think you would be able to add a small section to the testing wiki about testing the app with screenreaders and other assistive technologies? It's been a few years since I've done accessibility testing and I don't remember what the best practices are.

xscottxbrownx

This comment was marked as resolved.

@leekahung leekahung added the enhancement Enhancement of existing features label Nov 21, 2023
@milofultz milofultz force-pushed the issue-456/home-page-structure-enhancements--h1 branch from 1b57dd9 to 3be9bea Compare November 21, 2023 15:39
@andycwilliams
Copy link
Member

The test failed but once that's resolve I think this is good to go.

@xscottxbrownx
Copy link
Contributor

The re-written passing tests are in the branch we are trying to merge this code fix into.

@milofultz milofultz force-pushed the issue-456/home-page-structure-enhancements--h1 branch from 3be9bea to 80eec96 Compare November 24, 2023 16:20
@milofultz
Copy link
Contributor Author

The re-written passing tests are in the branch we are trying to merge this code fix into.

Rebasing this branch onto yours to get those tests

@milofultz milofultz requested a review from timbot1789 November 24, 2023 16:32
@milofultz
Copy link
Contributor Author

milofultz commented Nov 24, 2023

Assuming tests pass, I assume we could merge this and do a fast follow later for the concerns @timbot1789 has to not impede your branch merging @xscottxbrownx . Will leave it up to one of you three, as you have more PASS domain knowledge of what's best in a situation like this than I do.

@xscottxbrownx xscottxbrownx merged commit 323a65c into issue-456/home-page-structure-enhancements Nov 25, 2023
3 checks passed
@andycwilliams andycwilliams deleted the issue-456/home-page-structure-enhancements--h1 branch December 20, 2023 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants