angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.29k stars 6.73k forks source link

uib-dropdown-toggle <input> re-focusing on outside click #6321

Closed GAndriyS closed 7 years ago

GAndriyS commented 7 years ago

Bug description:

uib-dropdown-toggle re-focusing on outside click (e.g. another common, non-dropdown-toggle input)

Steps to reproduce

1) Click to toggle dropdown menu 2) Click on common input or outside of dropdown

Observed

Hide dropdown menu , focus returns to uib-dropdown-toggle

Expected

Hide dropdown menu, set focus to clicked element

Link to minimally-working plunker that reproduces the issue:

https://plnkr.co/edit/sxREBmeGwoFBQ4ZnOLIV?p=preview

Version of Angular, UIBS, and Bootstrap

Angular: v1.5.8

UIBS: Version: 2.2.0 - 2016-10-10

Bootstrap: v3.3.7

svisamsetty commented 7 years ago

@GAndriyS I am facing the same issue. Do you have any solution yet?

GAndriyS commented 7 years ago

@svisamsetty not yet, I'm waiting for developer's answer.

kwiateusz commented 7 years ago

On 2.3 that error is still present, and it's very annoying

neehouse commented 7 years ago

Having the same problem.. Resolved the refocusing issue by commenting out the focus call on the toggleElement.

scope.focusToggleElement = function() { if (self.toggleElement) { //self.toggleElement[0].focus(); } };

Not sure of any impact, but this gave back the ability to focus the items correctly.

The Angular-UI example, if you toggle a dropdown menu, and the scroll away and click, the same thing of the menu being re-focused occurs.

usos0k commented 7 years ago

Same issue. However, I face the issue only when I build the code as production mode. In my development mode, it works fine. Please anyone help!

alex88 commented 7 years ago

Same issue here, clicking everywhere focuses on the toggle element and scrolls the page making inputs not working

nicomelchiori commented 7 years ago

Same here. No matter what I do, everything works as expected before a dropdown-menu is clicked. After that, the last dropdown clicked will get focus no matter where I click

lukehutton commented 7 years ago

I did the following to fix for myself, https://github.com/angular-ui/bootstrap/pull/6353/commits/e07f9fd9fc8b63501cab45d3a38a00d6cb0233ad I updated an existing PR to support something else so obviously better to have separate PR for it

petedavis commented 7 years ago

+1 Thanks @neehouse for the suggested temp fix.

Gusi commented 7 years ago

+1

dougludlow commented 7 years ago

@lukehutton e07f9fd works great for me! Thank you!

GAndriyS commented 7 years ago

neither e07f9fd or 955848c don't works for me, described bug still can be reproduced in version 2.5.0

http://plnkr.co/edit/zanydRnj0ghWiEdvt4Cg?p=preview

rzawar commented 7 years ago

facing same issue. I cannot focus on input in different controller or even in same directive. But I can focus on different dropdown.