This repository was archived by the owner on May 29, 2019. It is now read-only.
focusFirstFocusableElement misses elements in modals including directivesΒ #6292
Open
Description
Bug description:
Recently-added code to auto focus the first focusable element in a modal does not work correctly when the modal includes other directives.
For example, we have a search-field
directive which includes a text input and a button. This directive is used inside the modal-body. Yet when this code is triggered:
$modalStack.focusFirstFocusableElement($modalStack.loadFocusElementList(modalWindow));
The array from loadFocusElementList
does not include our search field input. In our case, wrapping the above line in a $timeout
solves our issue, because our directive has compiled correctly by the next event cycle.
Link to minimally-working plunker that reproduces the issue:
https://plnkr.co/edit/9LQxnCyQIQuJLvfvTjkw?p=preview
Version of Angular, UIBS, and Bootstrap
Angular: 1.5.8
UIBS: 2.2.0
Bootstrap: 3.3.7