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

Trapping keyboard tab doesn't work on 1st modal after openning and then closing the 2nd modal #4416

Closed
leofachini opened this issue Sep 14, 2015 · 2 comments

Comments

@leofachini
Copy link

I don't know if this is a possible issue, but in the plunker presented by @paulorbpacheco in the issue #4004.
I've noticed some odd behavior. At some point, the focus wasn't being trapped inside the modal window anymore.

To reproduce that, please, do the following steps:

  1. Click on "Open me!" button.
  2. A modal window will open, then you will have to click in the "Open Another Modal!" button.
  3. Another modal will open again. Click in the "Ok" button to close/dismiss this modal.
  4. Now that we are back in the first modal window. Keep hitting tab or shift + tab key to see that the focus is not locked inside the modal window anymore.

Further this week I will take a look in the code and see if I come up with something useful.

This migth be related to the issue #4149.

@leofachini
Copy link
Author

Hi guys! I found out what was causing the issue.

There was the need of put this snippet of code: $modalStack.clearFocusListCache(); inside the dismiss and close modal functions.

This code is needed to clean the focusable element array when the modal is being dismissed/closed, since whe can open more than one modal at the same time, in order to always refresh the focusable elements regardless of the quantity of modals.

Here is the plunker.

Peace. 😎

@icfantv
Copy link
Contributor

icfantv commented Oct 29, 2015

Closing in favor of #4772.

@icfantv icfantv closed this as completed Oct 29, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants