Skip to content
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

Made expandable navbar section more accessible #3581

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

alexandrevryghem
Copy link
Member

References

Description

Improved the accessibility of the expandable navbar menu section. For all the keyboard interactions, I based them on the W3C guidelines. The only behaviors I haven't implemented are the Left Arrow & Right Arrow.

Instructions for Reviewers

List of changes in this PR:

  • Created new HoverOutsideDirective to detect when you hover outside a specific element to close the expandable modal. This also works when you open it using your keyboard and hover outside the expandable navbar afterwards
  • Added multiple new keyboard interaction behaviors:
    • Set focus on the first item when expanding the expandable navbar (with space & enter)
    • Added Up Arrow & Down Arrow support to navigate through the expandable navbar options
    • Close the expandable navbar with esc & shift + tab
    • Close the expandable navbar on tab and navigate to the next item

The only two keyboard interactions I didn't implement are Left Arrow & Right Arrow. To achieve these, we would need to know what the next & previous top-level items are. The cleanest approach would have been to trigger a tab/shift + tab event; however, doing this doesn't automatically set the focus on the next/previous top-level item, as this is controlled by the browser. Calculating these items using CSS selectors also didn't seem like a clean solution, which is why I didn't implement this.

Guidance for how to test and review this PR:

  • Verify that all the keyboard interactions from the W3C guidelines now work (except for Left Arrow & Right Arrow).
  • Some screen readers, like NVDA, block certain keys, causing specific keydown events to not work properly. If you have any screen readers, try enabling them to verify that this still works.

Checklist

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

@alexandrevryghem alexandrevryghem added bug accessibility claimed: Atmire Atmire team is working on this issue & will contribute back funded Task is funded via the DSpace Development Fund labels Oct 27, 2024
@alexandrevryghem alexandrevryghem self-assigned this Oct 27, 2024
@tdonohue tdonohue added port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release labels Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility bug claimed: Atmire Atmire team is working on this issue & will contribute back funded Task is funded via the DSpace Development Fund port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release
Projects
Status: 🙋 Needs Reviewers Assigned
Development

Successfully merging this pull request may close these issues.

"All of DSpace" menu in nav bar remains open and obscures site visibility when navigating by keyboard only
2 participants