Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown is closed when interacting with a form inside dropdown menu #3143

Closed
maxokorokov opened this issue Apr 25, 2019 · 3 comments
Closed

Comments

@maxokorokov
Copy link
Member

Bug description:

Dropdown menu shouldn't close itself when there is a form inside the dropdown menu and user is interacting with the form. Even with [autoClose]="true" (default)

Link to minimally-working StackBlitz that reproduces the issue:

Stackblitz with both ng-bootstrap and bootstrap dropdowns to compare:

https://stackblitz.com/edit/angular-uahpzh?file=index.html

To reproduce:

  • Click on ng-bootstrap button to open the menu
  • Click anything inside login form
  • Dropdown will close, but it shouldn't

Versions of Angular, ng-bootstrap and Bootstrap:

ng-bootstrap: 4.1.1

@martinezMaximiliano
Copy link

I am interested in working on this. I'm thinking I would create a ngbDropdownIgnore directive to ignore clicks on certain elements. So the user could apply this to the form or whatever other elements they want.

Is this an acceptable approach? If so, would that be considered a new feature instead of a bugfix? If not, would it be better to explicitly ignore form elements only?

@maxokorokov maxokorokov added this to the 4.1.3 milestone May 6, 2019
@maxokorokov
Copy link
Member Author

@martinezMaximiliano it is actually fixed by existing #3113.

The approach there was to close only on dropdown item clicks by default. This also fixes another issue with clicking on dropdown scrollbar.

@mhintzke
Copy link

mhintzke commented May 23, 2019

@maxokorokov I was just scratching my head for a good hour digging into the source code trying to figure out why my code (on v4.1.1) was not working when using the exact same code that is on in the documentation example here. Had to create a fresh Angular app and reproduce the scenario where I then inspected the source code and discovered your fix that was introduced in 4.1.3.

Thanks a lot!

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

No branches or pull requests

3 participants