Restores test and refactors component and test for layout-super-navigation-header #3939
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.
What
These changes restores a test that was temporarily removed and refactors both that and the component it relates to.
(Trello ticket: Refactor and improve recent change to layout-super-navigation-header component)
Why
When we made the changes in PR#3918 (Remove "Popular" links from super navigation header) we lost a recently added accessibility improvement, specifically to close the search menu when a keyboard user tabs out of that element. This was because this addition relied on the presence of links that were removed in the previous PR. We decided at the time to go ahead with that change and return to this to restore the lost behaviour.
This restores that by refactoring the original method dealing with that so that it doesn't rely on the presence of links but broadens the selector to include other tab-able elements. It also makes a small change to the original code for the search menu to make both more consistent with each other.