Search overlay: Improve accessibility#9035
Merged
nathanwoulfe merged 5 commits intoumbraco:v8/contribfrom Dec 2, 2020
BatJan:feature/search-a11y-improvements
Merged
Search overlay: Improve accessibility#9035nathanwoulfe merged 5 commits intoumbraco:v8/contribfrom BatJan:feature/search-a11y-improvements
nathanwoulfe merged 5 commits intoumbraco:v8/contribfrom
BatJan:feature/search-a11y-improvements
Conversation
nathanwoulfe
approved these changes
Dec 2, 2020
Contributor
nathanwoulfe
left a comment
There was a problem hiding this comment.
And again with the lovely work @BatJan
Same as the last one too - I fixed up the language conflicts, but otherwise all good.
Interested to hear too what would need to change in the search result data structure, it should be possible to modify the shape on the client, but might be more efficient to do so server-side...
🎅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Description
I have been wanting to take a stab at this forever since reading this wonderful article https://nolanlawson.com/2019/11/05/what-ive-learned-about-accessibility-in-spas/ on my way home from #umbUkFest10 ❤️
It's the part under the headline "The final boss: accessible autocomplete", which inspired me to improve the search feature in the backoffice.
However due to how the search results are currently wrapped I'm not able to add the parts including the use of ´aria-activedescendant´ and the parts about
role="option"so that's been omitted for now since I think it needs to be addressed in another PR - Unless @MMasey for or another brilliant person with BE skills is able to figure out if the data we get returned from the API call to /umbraco/backoffice/UmbracoApi/Entity/SearchAll could be changed around so we get all the results in one go but still with the ability to make a distinction between the categories etc. or maybe we can flatten the data we already receive in the FE somehow that I have not thought yet - It's something I would be happy to discuss at least :-)Ok, enough chatter - The following improvements have been made with this PR and they can stand alone as is
role="dialog",aria-describedbyandaria-labelledbyattributes along with asr-onlysection containing the sreen reader friendly title and description, which are required for dialog's, which the search overlay is 😃<input>and the<div>containing the search results using ´aria-owns´, which is used when a normal parent/child markup relationship is not possible to achieve. This attribute connetcs the two by using the idsearch-resultstabindex="-1"attribute on the clear button since we need to be able to tab to it in order for it to be accessible. It's an extra step before tabbing into the results but I think we will cope! Besides it's nice to tab to the clear button first incase you just want to cleae the search field 👼aria-hidden="true"to the<div class="umb-search-group__title">since anothersr-onlytext have been added to announce where the item was found since theumb-search-group__titlemakes sense in a visual context the screen reader is not picking up the name when tabbing / navigating back and forth using the up/down arrow keys. Hence this change<i>to<umb-icon>thoughout the viewOk, so a lot of stuff going on here - It's by purpose I have not added the
umb-focus.lockdirective since it does not handle adding focus on elements that are not there initially - This will be improved in the #8522 PR - Once it's done this view will need it too 😃