-
Notifications
You must be signed in to change notification settings - Fork 692
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
Added accessibility improvements (keyboard focus management / ARIA attribute) #166
Conversation
Since I'm integrating the accessible version with a full app, I've discovered a bug with focusable elements that are display: none and added a fix that filters out invisible elements. It uses the same technique that jQuery uses, so it should be fine down to IE8. |
Excellent!! +1 for be merged ASAP. |
@richardszalay this looks like a big change, is it ready to be merged? P.S. Please test it thoroughly in order to not break any existing functionality. Thanks! |
Having resolved one final niggle (focus outline added to dialogs with no focusable elements), I'm pretty happy with it now. I've run through the example page numerous times with both mouse and keyboard and it "feels" good from a focus perspective. I'm also using this build in a "mostly complete" site and have had no issues with the dialog functionality. |
The only bug I could find already was before this PR and is about Enter key to open a dialog. |
@octavioamu Have you been able to reproduce the Enter-double-open bug with this PR? |
@richardszalay yes I'm using your PR, This was happening before your PR too. |
@octavioamu Can you see if you can reproduce it in the "example" page that is part of the repo? I can't reproduce it myself so it's possible something in your app is causing the event to fire twice. |
@richardszalay You are right, looks like I'm doing something wrong, have not ideia what is producing that behavior. |
@richardszalay Ok, I'm using ngAria looks like this create some duplicate behavior only in the not happening when the element is a button. If cache is set to false both div created with enter have the same id, is cache is not set (true ) also create 2 dialogs but with different id |
@octavioamu It looks like it's actually a bug in ngAria, rather than with nDialog. See angular/angular.js#10388
|
@richardszalay Good to know. Thanks for the info. |
I'd love to see this merged. How can I help? |
@voronianski I'd say I'm definitely confident enough in the quality levels for it to be merged. Several people seem to be using it in large apps (myself included) and there's been no issues reported. |
@richardszalay ok, then could you rebase your PR with latest master and I'll merge it. |
@voronianski Done! |
if (dialogs.length === 0) | ||
return null; | ||
|
||
// TODO: This might be incorrect if there are a mix of open dialogs with different 'appendTo' values |
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.
@richardszalay I don't like such comments 😄
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.
Did you want me to remove it?
pls merge it, thank you |
@richardszalay ok, merging it. I would like to merge another cool enhancement PR and release new major version of ngDialog today or tomorrow. |
Added accessibility improvements (keyboard focus management / ARIA attribute)
Facing the same problem with version v0.4.0. Can anybody explain me in simple steps, How to fix this. |
I've added some improvements on the accessibility front, specifically around focus management and aria attributes.
The keyboard focus works across the examples (incuding the nested dialogs) and has been tested in IE 11/Chrome 40/Firefox 37 for browsers and Windows Narrator and NVDA for screen readers.
The updates to the readme (and lesser extent, the code) should describe the changes sufficiently, but I thought I'd discuss some details that could be deemed controversial.
Firstly, the keyboard focus support (specifically
trapFocus
, which I've enabled by default) forces the first content element (eg. p tag) to be focusable if there aren't any actual-focusable elements.This causes a focus rect to appear around it, which might cause some complains about styling (it can be disabled via CSS)This has been resolved in the latest commit, but it forces.css('outline','css')
on the element which might be controversial in its own right.Secondly, I've defaulted
ariaAuto
totrue
, which will automatically apply aria attributes based on the available content. It's possible this could conflict with users that have applied aria attributes in their dialog content.In both cases, my justification is that the vast majority of developers won't look at the accessibility side of things. I'd rather force the minority of accessibility-friendly developers to disable the features and have improved accessibility for the majority.
Happy to discuss further.