-
Notifications
You must be signed in to change notification settings - Fork 215
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
Use more descriptive accessible headings for search result pages #3941
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried it locally and it works well. I have some subjective opinions but not worth blocking the PR over.
But, if all that's changed is a11y of search headings, the changes to the snapshots are unwarranted. Looking into the changes it seems like the changes are due to font size differences, different shades of grey in checkboxes, and difference in waveforms of audio results. Maybe they are flakes and the checks will still pass if they are reverted?
count: "{localeCount} audio", | ||
countMore: "over {localeCount} audio", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subjective opinion: Number with 'audio' felt wrong.
count: "{localeCount} audio", | |
countMore: "over {localeCount} audio", | |
count: "{localeCount} audio tracks", | |
countMore: "over {localeCount} audio tracks", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in db46a04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sarayourfriend I believe "tracks" is still missing in the cases where the string is All results for "zack", 10 images and 10 audio
.
@sarayourfriend, I'm drafting this PR to prevent pings while the comments on prettier and snapshot changes are addressed. |
4357361
to
db46a04
Compare
1ad9617
to
1483eec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Requesting one small change for the last place where "tracks" is missing after "audio", and a non-blocking suggestion for code readability in the unit test.
frontend/test/unit/specs/components/v-search-results-title.spec.js
Outdated
Show resolved
Hide resolved
count: "{localeCount} audio", | ||
countMore: "over {localeCount} audio", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sarayourfriend I believe "tracks" is still missing in the cases where the string is All results for "zack", 10 images and 10 audio
.
e21c4c1
to
1e9b685
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great 👍 I appreciate the unit test improvements as well, like adding the translation job and excluding the tailwind prettier plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this PR on NVDA and VoiceOver.
NVDA reads the heading, and you can get to the heading using the H
shortcut.
In VoiceOver, you have to navigate inside the heading element to read the heading using the shortcut (VO+command+H). If you try the same shortcut when the VO focus area is in the content area (one level above), it says "Heading not found". I'm not sure if it's supposed to be like that, or if I'm using VO incorrectly, or if VO has a bug, but I couldn't find a way to navigate through the headings on the search page.
@@ -14,7 +14,8 @@ module.exports = { | |||
{ | |||
files: ["frontend/**/*"], | |||
options: { | |||
plugins: ["prettier-plugin-tailwindcss"], | |||
// Do not include tailwind plugin in test environment, as it breaks jest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great find!
type KeyCollection = { | ||
zero: string | ||
count: string | ||
countMore: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better naming ✨
A few snapshots need updating after the merge of #3967 |
1e9b685
to
d87c9cd
Compare
I had to squash this PR, the back-and-forth commits were making rebases a pain. I should be able to merge this now so long as CI passes, there are no changes other than updates to the snapshots that Zack mentioned. |
Hi there, I've made some enhancements to the code to address the issue described in WordPress#3941. Following the convention established, I updated references to audio works to use the phrase "audio track(s)" instead of just "audio". Please review the changes and let me know if there are any further adjustments needed. Thank you for considering my contribution.
Hi there, I've made some enhancements to the code to address the issue described in WordPress#3941. Following the convention established, I updated references to audio works to use the phrase "audio track(s)" instead of just "audio". Please review the changes and let me know if there are any further adjustments needed. Thank you for considering my contribution.
Hi there, I've made some enhancements to the code to address the issue described in WordPress#3941. Following the convention established, I updated references to audio works to use the phrase "audio track(s)" instead of just "audio". Please review the changes and let me know if there are any further adjustments needed. Thank you for considering my contribution.
Hi there, I've made some enhancements to the code to address the issue described in WordPress#3941. Following the convention established, I updated references to audio works to use the phrase "audio track(s)" instead of just "audio". Please review the changes and let me know if there are any further adjustments needed. Thank you for considering my contribution.
* Issue #3941 resolved Hi there, I've made some enhancements to the code to address the issue described in #3941. Following the convention established, I updated references to audio works to use the phrase "audio track(s)" instead of just "audio". Please review the changes and let me know if there are any further adjustments needed. Thank you for considering my contribution. * Grammatical issues resolved. * Fixed grammatical issues * Fix linting error * Suggestions added * Changes made. * Changes made. * Remove unnecessary 'files' * Changes made. * Add trailing blank line * Add missing space * Add a missing article Signed-off-by: Olga Bulat <[email protected]> * Update snapshots Signed-off-by: Olga Bulat <[email protected]> --------- Signed-off-by: Olga Bulat <[email protected]> Co-authored-by: Olga Bulat <[email protected]>
Fixes
Fixes #790 by @alexstine (by way of @zackkrida extracting the issue from a tracking issue of several required accessibility fixes)
Description
The large number of added lines come from snapshot tests, not actual code changes. See the testing instructions section for details about these.
The PR adds new sr-only text to the page, as suggested by Alex in the issue. I've chosen to use different variations based on the search type and count of media. In my first attempt, I used two separate h1s. However, this caused an issue with introducing unintended height. Rather than adding additional classes to the second one to prevent that, I decided to just put them inside the same h1, with each bit wrapped in a
span
so I could mark them as aria-hidden orsr-only
as needed. This appears to work in all my testing (ORCA on Linux, NVDA on Windows and VoiceOver on macOS, the latter two in VMs), but please try to break this to make absolutely sure I've got it right.Testing Instructions
Run the application locally using
just p frontend dev
from the root directory of the repository.Execute a search from the homepage, and using a screen reader, observe the h1 of the page. Confirm it meets the requirements laid out in the issue.
I used snapshot tests rather than individual assertions for each possibility of the accessible text because otherwise I would have to duplicate the translation, which isn't the point. Ideally this would use a diff snapshot test, render a couple "baseline" variations, and then snapshot diff against those to confirm they are all different in code, but you can do this by reading the snapshots themselves. This is a small component, so the snapshots are not too cumbersome.
I wanted to use inline snapshots, because I've found those easier to work with in the past. However:
each
testeach
block, and I was worried about how many different formatting issue's I'd need to fight against overall. We should disable that trailing whitespace check for anything linted by ruff, prettier, or eslint, though, as it's just duplicating those tools and is less configurable in cases like this... plus, in this case, it was modifying a string literal in the code, which is no good!Anyway, that's out of scope for this issue. I just wanted to explain the decisions I made there.
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin