-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Cannot focus on input element of modal form after using uib-dropdown #6364
Comments
Also experiencing the same problem in UIBS 2.3.1, works in 2.2.0. |
Same here. After opening the uib-dropdown, inputs lose their focus on mouseup. Input does not to be necessarily on a modal. Any input on same page or even after routing to another page does not accept focus after opening the uib-dropdown. |
Same problem. Also happens on Getting Started Page: Drop down element always get focused. |
I had the same problem, and after spending half of my working day I found reason. Please look at the source code of dropdown https://github.com/angular-ui/bootstrap/blob/master/src/dropdown/dropdown.js and you can find This piece of code works for me:
|
Bug for me happened even when focus on a input inside modal so I think you
issue is separate
…On Wed, Dec 14, 2016, 8:29 AM Andrzej Dybionka ***@***.***> wrote:
I had the same problem, and after spending half of my working day I found
reason. Please look at the source code of dropdown
https://github.com/angular-ui/bootstrap/blob/master/src/dropdown/dropdown.js
and you can find focusToggleElementfunction which is invoked untidy when
you use uib-dropdown-toggle directive on <a> tag which has hrefattribute.
To workaround this bug just remove href attriibute from link.
This piece of code works for me:
<div uib-dropdown>
<a uib-dropdown-toggle>Open menu</a>
<ul uib-dropdown-menu >
<li>...</li>
</ul>
</div>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6364 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAh7gl_1Yirym_zoOmbDeUSEz3oEzKNBks5rH-9CgaJpZM4LLljW>
.
|
It is the same reason:
by this
here https://plnkr.co/edit/Aa8zqYgrqd5o0a1yy4EU?p=preview Of course this is only workaround and bug should be fixed by authors of ui-bootstrap. |
@adybionka spot on! Looks like the culprit is in dropdown.js on line 108. The closeDropdown is being invoked on document.click so it focuses the toggleElement (if focusable) every time someone clicks. |
I confirm this issue happening on |
Removing the |
This seems to be a duplicate of #6357 |
Another workaround of this problem is just not use
And in controller:
|
It looks like the root of the problem was identified by @vukers: |
@mattlewis92 has a pull request with the fix: #6363 |
seems like #6321 related too (text input focus bug) |
Downgrading a bit to avoid issue with 2.3.0: angular-ui/bootstrap#6364
Yeah, we are experiencing the same issue. We were developing on 2.3.0 and our deployment today went out with 2.3.1 causing widespread breakages for our drop downs. |
Downgrading a bit to avoid issue with 2.3.0: angular-ui/bootstrap#6364
Downgrading a bit to avoid issue with 2.3.0: angular-ui/bootstrap#6364
) * Change version of angular-bootstrap to 2.2.x Downgrading a bit to avoid issue with 2.3.0: angular-ui/bootstrap#6364 * Convert sort, filter, and toolbar modules directives to components * Add restrict E to ng-docs, enforce single select on toolbar filtering.
Same issue with 2.3.1 and angular 1.5.9. Reversing to 2.3.0 solve issue. Waiting for fix |
I still have to click input fields twice in order to get the focus to move there, once to close the dropdown and again to shift focus (regardless of whether the input is in a modal or not). (Angular 1.5.10, UIBS 2.4.0) |
The same behavior as @mold described for Angular 1.5.7 and UIBS 2.3.0 Dropdown always grabs focus for itself when toggle happens. |
Also experiencing this bug. Going back to 2.3.0 did not seem to help |
Bug description:
In brief, triggering a modal form after using a uib-dropdown on the page makes it impossible to focus on the form input.
Try the following in the provided plunker:
Click button (A) to activate modal form.
Click on the input & it focuses
Click the uib-dropdown button 'Select' (no need to select menu button (B))
Click button (A) again. It is not possible to focus on the input
Link to minimally-working plunker that reproduces the issue:
https://plnkr.co/edit/Aa8zqYgrqd5o0a1yy4EU?p=preview
Version of Angular, UIBS, and Bootstrap
Angular: 1.5.8
UIBS: 2.3.1
Bootstrap: 3.3.7
Other comments
It used to work in UIBS 2.2.0.
The text was updated successfully, but these errors were encountered: