DP-23086 A11y when org search is not shown, it should be fully hidden for all users#1531
DP-23086 A11y when org search is not shown, it should be fully hidden for all users#1531
Conversation
… instead heading for interation
…tps://github.com/massgov/mayflower into patternlab/DP-23086_organization-search-keyboard
So, I fixed the keyboard focus trapping issue:The sub nav part was more involved:
|
| } | ||
| // Capture click, spacebar and enter keys. | ||
| $mobileToggle.keypress(function() { | ||
| if (event.which == 13 || event.which == 32) mobileToggleClick(); |
There was a problem hiding this comment.
.which is deprecated and don't support IE11, please use KeyboardEvent.key and KeyboardEvent.code for new code.
There was a problem hiding this comment.
thanks, I just updated this.
| } | ||
|
|
||
| // Capture click, spacebar and enter keys. | ||
| $mobileToggle.keypress(function(e) { |
There was a problem hiding this comment.
| $mobileToggle.keypress(function(e) { | |
| $mobileToggle.keypress(function(event) { |
There was a problem hiding this comment.
I changed it with keyboardEvent
packages/patternlab/styleguide/source/assets/js/modules/organizationNavigation.js
Outdated
Show resolved
Hide resolved
| $button.on('focus', function () { | ||
| $thisMenu.find("a[href]").attr("tabindex", -1); | ||
| $otherMenus.find("a[href]").attr("tabindex", -1); | ||
| // $button.on('focus', function () { |
There was a problem hiding this comment.
This is the commented code I mentioned above
…zationNavigation.js Co-authored-by: Minghua Sun <clairesunstudio@gmail.com>
| } | ||
|
|
||
| $('.item-open').removeClass('item-open'); | ||
| // TO DO: Close mobile menu container. |
There was a problem hiding this comment.
Note for TO DO:
This is tricky one. It's meant to close the mobile menu container, which is different from one above. The one above at L. 182 closes an open submenu. Based on the way the mobile nav works, this is triggered when submenus are closed, which means one of the navigation buttons/links or the search is supposed to have focus. If you just check if the mobile container is open for the trigger, the condition also applies to L. 182.
|
@Javi-er I merged my changes into your branch. Template + CSS
JS
Here is the to-do list. At the point my changes were merged, I did some quick testing with keyboard and screen readers. Items listed at the fix are not working as expected. Not sure if they are syntax or jQuery issues or something else. TO DOs
|





Any PRs being created needs a changelog.txt file before being merged into dev. See: Change Log Instructions
Description
Hides the search form so it's not focusable by the keyboard instead of using just opacity.
Related Issue / Ticket
Steps to Test
Screenshots
Use something like licecap to capture gifs to demonstrate behaviors.
Additional Notes:
Anything else to add?
Impacted Areas in Application
@todo
Today I learned...