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

Feature Request: Dropdown open trigger selection (hover, click) #3193

Open
dstj opened this issue May 14, 2019 · 3 comments
Open

Feature Request: Dropdown open trigger selection (hover, click) #3193

dstj opened this issue May 14, 2019 · 3 comments

Comments

@dstj
Copy link

dstj commented May 14, 2019

Feature Request

I think it would be cleaner to support controlling some common Dropdown triggers as an option of the NgbDropdown instead of reverting to manual control.

For example, for hover, I'd much rather do

<div ngbDropdown [trigger]="'hover'">

then the current solution of

<div #myDrop="ngbDropdown" (mouseenter)="$event.stopPropagation(); myDrop.open();"
(mouseleave)="$event.stopPropagation(); myDrop.close();">

It could (should?) support multiple triggers, i.e. [trigger]="'hover click manual'". This would also be similar to the [placement] option.

Related issue #1117, #2375

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: 7.2.15
ng-bootstrap: 4.1.2
Bootstrap: 4.3.1

@benouat
Copy link
Member

benouat commented May 15, 2019

Hey @dstj !

I'll flag it as feature request for now, but just one quick word nonetheless, Bootstrap does not provide such trigger option on the dropdown itself.

Semantically speaking, dropdowns are meant to be opened with mouse clicks and/or keyboard. Opening on focus remains a marginal use-case to me. Hence my first feeling would be to keep it as of today and use the (verbose) solution you proposed...

@axos88
Copy link

axos88 commented Feb 1, 2020

@benouat the use case is pretty common in navbars

@timon0305
Copy link

timon0305 commented May 4, 2021

Great sharing
It is working well

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

4 participants