Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Focus is now trapped when modal is opened. It works in both directions with tab or shift+tab. #4004

Closed

Conversation

paulorbpacheco
Copy link

Fix Modal: Focus is now trapped inside when modal is opened. It works in both directions with tab or shift+tab. No more focus tab on background.
Refs: #738, #3689

@wesleycho
Copy link
Contributor

Does this work with multiple modals?

@paulorbpacheco
Copy link
Author

I didn't use with multiple modals, I tested using the main components page. I will create a plunk today and post here.

@paulorbpacheco
Copy link
Author

It's working!!
http://plnkr.co/izQCgs71XzDt3anp7ZH7
Sorry about it. I closed this pull request accidentally.

@e-cloud
Copy link

e-cloud commented Jul 28, 2015

nice, 👍

@@ -6,7 +6,7 @@ <h3 class="modal-title">I'm a modal!</h3>
<div class="modal-body">
<ul>
<li ng-repeat="item in items">
<a ng-click="selected.item = item">{{ item }}</a>
<a href="#" ng-click="selected.item = item">{{ item }}</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for this change? I think you should revert this, as I think it would have an adverse effect on the docs page.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I think I get it - maybe change ng-click to

$event.preventDefault(); selected.item = item

@wesleycho
Copy link
Contributor

Work here is pretty solid, just needs some code style clean up - I will merge this shortly with all of the needed minor/cosmetic fixes.

@wesleycho wesleycho added this to the 0.13.2 (Performance) milestone Jul 28, 2015
@wesleycho wesleycho self-assigned this Jul 28, 2015
@wesleycho wesleycho closed this in a028d2a Jul 28, 2015
@e-cloud
Copy link

e-cloud commented Aug 8, 2015

@wesleycho , @paulorbpacheco
thanks for your effort on the traping tab feature on the modal module. but i have a trouble with the new feature.

i use a tabset in the modal. when i update to v0.13.2, my modals without tabs work as expected, but it turn to tabs and modal aggregation, it can only trap the tab key on the second tab of the tabset.

here is a plukr that reproduce the problem.
http://plnkr.co/edit/wwgZhXu0fru4L703z5by?p=preview

i'm not sure if i use it on the wrong place or the modal source code has some bugs not concerned yet.
can you guys offser some help?

@wesleycho
Copy link
Contributor

Can you file a new issue? This isn't the place to discuss it.

@e-cloud
Copy link

e-cloud commented Aug 8, 2015

ok, i have filed it just now

@paulorbpacheco
Copy link
Author

Hello @e-cloud,
Thank you so much for find this bug. I would never think to use tabs inside modals :). Did you create the issue?

@wesleycho
Copy link
Contributor

#4149

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

Successfully merging this pull request may close these issues.

3 participants