question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dropdown - autoclose on outside click option

See original GitHub issue

Feature request

It would be a useful addition to have another autoClose option: onOutsideClick (or another meaningful name), so we can keep the dropdown open as long as we click somewhere inside it.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:11
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pkozlowski-opensourcecommented, Aug 9, 2017

Since this project uses Typescript and Typescript supports enums, you all may want to consider changing autoClose to accept an enum instead of a boolean.

@forrestab enums are not ideal since you would have to expose an enum on a component’s instance. In practice to achieve the following:

<div ngbDropdown [autoClose]="CloseEnum.INSIDE">
...html
</div>

You would have to have CloseEnum on the component’s instance which is too much pain in practice, IMO. How about the following API:

@Input() autoClose: boolean | 'inside' | 'outside';
0reactions
pkozlowski-opensourcecommented, Aug 12, 2017

@matthiasscudlik you are right, we are planning to change it. The issue is already tracked via #900

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I close a dropdown on click outside?
Where close is your function which will be call when user click outside div. It is very elegant way to handle problem described...
Read more >
Angular Dropdown Menu Close On Click Outside
As you can see in browser, we can close our dropdown now with click outside. And this directive is fully reusable in any...
Read more >
How to avoid dropdown menu to close menu items on ...
Click Inside: · Click Outside: O/P after click outside.
Read more >
Bootstrap 4 prevent dropdown close click outside on Codeply
Bootstrap 4 prevent dropdown close click outside Codeply example.
Read more >
Hide Dropdown Menu on Click Outside of the Element in ...
You can use the jQuery click() method in combination with the on() method to hide the dropdown menu when the user click outside...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found