-
Notifications
You must be signed in to change notification settings - Fork 437
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
Header Accessibility Fix: Allow enter key or spacebar to expand or contract menu based on current active status #1315
Conversation
ce71532
to
523fca2
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.
Thanks @tdonohue!
This does what it says, and can be merged as is.
But in the admin sidebar menu (and most other places where we added these keyboard commands, e.g. opening and closing the search facets) we made both space and enter do the action, so for consistency it would be good if you could add space as well
@artlowel : Thanks for the initial review. Since it wasn't much work, I added support for spacebar as well. Just as a note though, at least in Chrome spacebar doesn't work as well as Enter key...as click "spacebar" on any menu item scrolls you down to the bottom of the page (while also now opening/closing the menu). This seems to be the same behavior as on demo7.dspace.org though & I didn't have time to try and debug it (as it seems unrelated to this larger accessibility issue) |
@artlowel : Unfortunately, that suggestion doesn't appear to work in this scenario. I tried it locally, and changed this line to:
That seems to have no effect for me. I can still open/close the menu using the spacebar, but anytime I do so, it auto-scrolls me to the bottom of the page. I think there may be a larger issue at play here, as anytime you hit the spacebar while highlighting any part of the header (even just with the header logo highlighted) you are scrolled to the bottom of the page. So, I think we may want to treat this as a separate issue. It sounds like some sort of default behavior needs to be changed for the entire header, and it's not specific to this single menu option. Maybe we simply leave this PR as-is and open a separate ticket about the spacebar scrolling to the bottom of the page? |
@tdonohue AFAIK "spacebar to scroll down" is the default behaviour for most browsers though, so I think that's to be expected if the components in play here don't override defaults for On any long page I did solve a similar thing though, I'll go over that other PR tomorrow & see if there was anything more to it than that |
Quick thought right now: could be that the callbacks in #1295 also included |
@ybnd and @artlowel : I appreciate the help, but still no luck. I've gone ahead and pushed a commit with what I've tried -- adding both I'm willing to try a few more ideas if you think this should be solveable. But, at the same time, this wasn't reported as an accessibility bug by Deque (they only reported issues with using the Enter key to open/close menus) -- so, it's really a question of how much time we spend on trying to get spacebar to also work. |
@ybnd and @artlowel : Found a bit of time to dig into this today. It turns out it was something simple... If one of you could give this a test on your end, I'd appreciate it. I think it's probably ready to merge now. |
eece8f3
to
1d0a5c0
Compare
@tdonohue I tested it again, and while it works properly now to open and close dropdowns, I can no longer use enter or space to go to a link inside a dropdown. That does work on the demo site. Perhaps one of those prevent defaults interfering? |
@artlowel : Good catch. It seems the |
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.
That works!
Thanks @tdonohue!
40c02b5
to
b4732f3
Compare
Merging with one approval |
DSpace#1315) DSC-1387 export menu in person entity main cris Approved-by: Davide Negretti
References
Small improvement to the fixes to #1167 in PR #1252
Description
Deque retested those header fixes, and found one issue was only partially fixed.
This PR fixes that issue by ensuring pressing "Enter" will open/close that menu based on the current status.
Instructions for Reviewers