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

Modals are focused on opening, for improved acessibility #690

Merged
merged 1 commit into from
May 24, 2015

Conversation

jportela
Copy link
Contributor

Modals are now focused when opening them, as requested by #612 . I've also stored the element that was previously focused, so its focused can be restored when the Modal is closed (it is the same behaviour Bootstrap does).

I was unable to do tests for this, as it has a dependency on document.activeElement (and the tests I've looked into only used TestUtilities.renderIntoDocument, which renders to a detached DOM node, so I'm guessing we can't test this without attaching it to the DOM).

@mtscout6
Copy link
Member

You can test this, checkout how I'm doing so with the Dropdown work I'm doing on the dropdown-revisited branch tests.

@mtscout6
Copy link
Member

This is a great start for accessibility of the modal! Have you considered ensuring that keyboard navigation via tabbing does not allow you to tab to the components under the modal? This is another concern to deal with for Modal accessibility. I understand if that's more than you'd like to tackle in this PR, but if you're up to it we can wait till that's also available. (Note: http://www.w3.org/WAI/PF/aria-practices/#modal_dialog)

@jportela
Copy link
Contributor Author

Thanks @mtscout6 for pointing out the tests, I'll start by adding the test case. And I'm happy to add the extra for not allowing to focus on the components under de modal, which makes sense. I'll try to tackle these today.

@mtscout6
Copy link
Member

You rock, thanks!

@mtscout6 mtscout6 added this to the 1.0.0 Release milestone May 18, 2015
@jportela
Copy link
Contributor Author

added tests. Will still develop the feature to only focus on the components under the modal, today I hope

@mtscout6
Copy link
Member

The test looks great!

Can you squash the commits and use the commit message standard outlined in the Contributing Guide? That way this change will be documented in the automated changelog when we push a release.

@jportela
Copy link
Contributor Author

sure, would this be considered a fix ([fixed])?

On Sat, May 23, 2015 at 3:07 PM, Matt Smith notifications@github.com
wrote:

The test looks great!

Can you squash the commits and use the commit message standard outlined in
the Contributing Guide
https://github.com/react-bootstrap/react-bootstrap/blob/master/CONTRIBUTING.md#commit-subjects-for-public-api-changes?
That way this change will be documented in the automated changelog when we
push a release.


Reply to this email directly or view it on GitHub
#690 (comment)
.

Adds test case for focusing on the modal when opening it
@mtscout6
Copy link
Member

Perfect!

Everything here LGTM, you can do the additional work to keep focus within the modal on another PR. I opened issue #723 which defines that separate problem.

Need another review by one of the @react-bootstrap/collaborators

@AlexKVal
Copy link
Member

👍
Perfect. Simple and clean. I like it.
Thank you 🍒

@AlexKVal AlexKVal closed this May 24, 2015
@AlexKVal AlexKVal reopened this May 24, 2015
AlexKVal added a commit that referenced this pull request May 24, 2015
Modals are focused on opening, for improved acessibility
@AlexKVal AlexKVal merged commit 0fda76a into react-bootstrap:master May 24, 2015
@AlexKVal AlexKVal mentioned this pull request May 24, 2015
},

focusModalContent () {
this.lastFocus = document.activeElement;
Copy link
Member

Choose a reason for hiding this comment

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

Should this be ownerDocument?

Copy link
Member

Choose a reason for hiding this comment

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

@taion Good catch, though since this PR has already been merged lets create an issue (#729) for this and follow up on another PR.

Copy link
Member

Choose a reason for hiding this comment

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

Is it connected with iframes ?
I'm just not aware of use cases for this.
(have no such expirience)

Copy link
Member

Choose a reason for hiding this comment

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

As far as I can tell yes it is in relation to iFrames. I wasn't even really aware of that property and why to use it till I read up on it this weekend. So thanks @taion for steering us in a good direction.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you.
It is important for me to know about it.
Also I'll be able to do more comprehensive code reviews with regard to iFrames.

Copy link
Member

Choose a reason for hiding this comment

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

iframes aren't that high on my list of concerns, I was just following the other code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants