Search Page Implementation & Review Fixes#205
Search Page Implementation & Review Fixes#205rianrietveld merged 30 commits intowpaccessibility:mainfrom
Conversation
|
@kurapativyshnavi thanks! |
This is a copy of the file from PR 90.
joedolson
left a comment
There was a problem hiding this comment.
There are a number of changes required to make this functional.
|
This doesn't update after the initial load, and shouldn't be live.
This isn't readily internationalizable, but none of the theme text is, so that's probably not a thing to worry about.
Makes this reusable.
- Close search results if focus leaves container - Let arrow keys actually move focus and execute arrow key support within the results instead of only from the search field
rianrietveld
left a comment
There was a problem hiding this comment.
Yes, it works, thank you!
A few things:
The Skip link brings you to the first link in the content, skipping the search.
2 ways to solve this:
- add a skip to search or
- let the skip link move to the search input field.
This is personal, but I really hate the <mark> in your face 1999 styling.
Please remove that yellow and only leave bold in the CSS for mark.
There is an empty <mark></mark> and <span></span>.
<div class="search-result-section">
<mark></mark>
<mark class="search-result-highlight">WCAG Succes Criteria</mark>
<span></span>
</div>
With the mobile search, I find it unexpected that the focus scrolls up to the top of the window. We can wait and see what the auditor says about that.
Suggestion:
We can add a description to the pages and use that instead of the uri below the link.
Question:
DId you add pagination?
And note to self:
The headings must be more descriptive, search for WCAG gives multiple times the same vage results. I will fix that.
| searchResults.appendChild(resultsList); | ||
| screenReaderFeedback.innerText = results.length + ' results found, tab to read them'; | ||
| if ( results.length === 1 ) { | ||
| screenReaderFeedback.innerText = results.length + ' result found, tab to read it'; |
There was a problem hiding this comment.
'tab to read it' is in fact 'arrow down to read it', a tab brings you to the search button.
There was a problem hiding this comment.
Close the list of search results when the focus moves to the search button.
There was a problem hiding this comment.
Currently, you can navigate to the search results either using tab or using arrows. Before this PR, it was only by tab. Do we want to only support arrows? In that case, I'd want to also add some visual affordance so that's more obvious.
There was a problem hiding this comment.
No, it's about the tab order and the instruction text. You go from input to search buttons to search results. And then the text "tab to read it" doesn't make sense.
But if you change the tab order, one is forced to tab through all the results to get to the submit button. and that's no use either.
In fact, how it works now is great, but if you cannot see, the focus on the submit button instead of the results could be confusing. Am I overthinking this?
There was a problem hiding this comment.
So, I was responding to your second comment, not the first. The text change makes sense; but if we close the list of search results when focus moves to the search button, then a user can't get to the search results using the tab key.
|
Additional: If you press enter and not the search button to submit the search, the |
Appears to be a bug in just the docs.
I'm assuming that some configs of the theme do partial word highlighting? Not sure.
|
I've dealt with most things here, and the ones I haven't addressed are things I think should be handled in a follow up, if needed.
|
There was a problem hiding this comment.
@joedolson
I agree with your choices, let’s merge this now.
Thanks so much for your work!
I've implemented the dedicated search results page and resolved all code issues from the review.
What was changed:
search.html: Added this new file for the search results page layout.
_includes/components/search_header.html: Added the new search input and the search-submit button markup.
_sass/components/_search.scss: Updated the styles. I used Flexbox to line up the search input and button, and added CSS to make the submit button visible with an accessible :focus state.
assets/js/wp-a11y-docs.js: Changed the document ready function to jtd.onReady().
Added logic to re-populate the search box with the URL query when the page loads.
Implemented code to wait for the search index to finish loading before running the search, resolving the timing issue.
Thanks for the review!