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

Feature/focus mgmt main menu #2101

Merged
merged 1 commit into from
Nov 18, 2019
Merged

Feature/focus mgmt main menu #2101

merged 1 commit into from
Nov 18, 2019

Conversation

marcus-herrmann
Copy link
Contributor

Description

The content of this PR deals with keyboard focus management in the context of the off canvas navigation. It has got to major parts

  1. Preventing that interactive items in hidden off-canvas menu can be focussed
  2. Sending focus in the menu once it opens, back to triggering button once it closes

Related Issue

Motivation and Context

Improve Accessibility: Keyboard navigation is not only crucial for keyboard only users, but all screen reader users

How Has This Been Tested?

Manually by hitting tab key and logging the document.activeElement in the browser's console.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised

Open tasks:

  • ...

@CLAassistant
Copy link

CLAassistant commented Sep 30, 2019

CLA assistant check
All committers have signed the CLA.

*/
setTimeout(() => {
this.$refs.menubutton.$el.focus()
}, 500)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it need to be a fixed delay value or can it be done with this.$next() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

500-100ms is a recommended value. setTimeout 0 or this.$next are too short, we have to wait for the Virtual Buffer of the screen reader. This can't be perceived via JS.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we are using this patterns in multiple places, I wonder if there is a way to make it more Vue-y.

Maybe implement something like this.$next but call it this.$afterScreenReaderInit or something so that it becomes self-explanatory ? The latter implementation can then contain whatever value we chose for the delay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afterScreenReaderInit sounds like an actual hook/lifecycle event. I would go with delayForScreenreader or the like. Emphasising that it is a form of guessing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcus-herrmann your proposal sounds good

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PVince81 So this would be eventually a Vue mixin which potentially every component can access, and it its core a wrapper around a setTimeout in order to not need to comment it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcus-herrmann yes, that would be a way.

One question that does come to mind is how can developers know when to use it and when not to. Does this need some experimentation with accessibility test systems or is there a common pattern ? If the latter, it could be included in the design guidelines in some form.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PVince81 It's always better to test/experiment with assistive technology, but I can devote a particular page in the design guidelines about screen readers and problems with web-apps (which are, predominantly, DOM-changing, asynchronously loading, stateful constructs, all of which makes them kind of hard to grasp for screen readers). Sending focus to elements in dynamic DOM parts of the application (like this, or after routing) would be just one part of the challenges, accessible notifications, live search and filtering would be others.

@@ -118,6 +118,7 @@
]
},
"dependencies": {
"deepmerge": "^4.0.0"
"deepmerge": "^4.0.0",
"inert-polyfill": "^0.2.5"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting. so we could in theory use this attribute for all elements whenever a modal is open. might need to track the info whether a modal is open in the global store.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inert does make sense in general when there is need for rendering parts of the DOM inert/inactive/unreachable for assistive technologies/keyboard users. The elements "behind" an open modal are the most prominent use case: https://github.com/WICG/inert/blob/master/README.md

@PVince81
Copy link
Contributor

PVince81 commented Oct 8, 2019

  • please click on the CLA assistant to sign it
  • please resolve the dependency conflict

I had a quick test and focus management looks fine for the regular case

@marcus-herrmann
Copy link
Contributor Author

After the click I get a broken cla-assistant.io page and: "Error - There is no CLA to sign for owncloud/phoenix"

@PVince81
Copy link
Contributor

PVince81 commented Oct 8, 2019

@DeepDiver1975 can you confirm the "no CLA" case ? I also get a rather broken page from the CLA bot when I open https://cla-assistant.io/owncloud/phoenix?pullRequest=2101

@marcus-herrmann
Copy link
Contributor Author

@DeepDiver1975 Could you point me towards what you mean by dependency conflict?

@LukasHirt
Copy link
Contributor

Could you point me towards what you mean by dependency conflict?

Conflict inside of package.json

@ownclouders
Copy link
Contributor

💥 Acceptance tests Files failed. Please find the screenshots inside ...

https://drone.owncloud.com/owncloud/phoenix/5767/

20191016-173645-109.png
20191016-174137-704.png
20191016-174205-415.png
20191016-174232-821.png
20191016-174307-732.png
20191016-174333-567.png
20191016-174413-451.png
20191016-174442-173.png
20191016-174509-224.png
20191016-174606-974.png
20191016-174641-536.png
20191016-174716-290.png
20191016-174741-922.png
20191016-174808-249.png
20191016-174834-279.png

@marcus-herrmann
Copy link
Contributor Author

@DeepDiver1975 can you confirm the "no CLA" case ? I also get a rather broken page from the CLA bot when I open https://cla-assistant.io/owncloud/phoenix?pullRequest=2101

Just was able to sign the CLA.

@PVince81
Copy link
Contributor

@marcus-herrmann @LukasHirt can we move this forward ? I'll need the inert functionality soon

@marcus-herrmann
Copy link
Contributor Author

@PVince81 From my part yes, although I am not sure what exactly is causing the failing build

@PVince81
Copy link
Contributor

@marcus-herrmann please rebase. There were random failures in the past and they will hopefully disappear now. If not I can have a look later on.

Add focus management regarding off canvas main nav, #1647
@marcus-herrmann
Copy link
Contributor Author

@PVince81 Done

@PVince81
Copy link
Contributor

seems the tests would pass. the two failures are due to "npm install" not going through...

I've restarted the build

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@PVince81 PVince81 merged commit 4aeb2ec into master Nov 18, 2019
@delete-merged-branch delete-merged-branch bot deleted the feature/focus-mgmt-main-menu branch November 18, 2019 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status:Needs-Review Needs review from a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Control menu navigation with keyboard
5 participants