dropdown item keyboard selection with autoclose = true not happening
See original GitHub issueBug description:
- click on drop down with autoClose = true
- press arrow down
- press enter current:
- dropdown is closed while click handler of dropdown item was not fired expected
- dropdown is closed and click handler of dropdown item was fired
selection works when autoclose is false.
Link to minimally-working StackBlitz that reproduces the issue:
https://stackblitz.com/edit/angular-6c8p1w?file=app/dropdown-manual.ts
Versions of Angular, ng-bootstrap and Bootstrap:
Angular: reproduced on 8.0.0 and 7.1.3 ng-bootstrap: 4.2.1 Bootstrap: 4.3.1
excerpt from src/dropdown/dropdown.ts
...
// closing on Enter / Space
if (key === Key.Space || key === Key.Enter) {
if (isEventFromItems && (this.autoClose === true || this.autoClose === 'inside')) {
this.close();
}
return;
}
// opening / navigating
if (isEventFromToggle || isEventFromItems) {
....
navigation is not happening when user press enter or space. Would you mind if I change it to allow navigation and close dropdown async if it required? I suppose without async closing dropdown item will disappear before click event fires.
upd found a workaround and added into the stackblitz. good enough for now.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Avoid dropdown menu close on click inside - Stack Overflow
By default, the dropdown menu is closed when clicking inside or outside the dropdown menu. You can use the autoClose option to change...
Read more >Dropdowns - Bootstrap
Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They're made interactive with the included Bootstrap dropdown ...
Read more >Dropdowns | React-Bootstrap
By default, autoClose is set to the default value true and behaves like expected. By choosing false , the dropdown menu can only...
Read more >Select does not open dropdown onclick | Firefox Support Forum
We found that the problems root was inside the fact that the datepicker was inside a colorbox modal. We avoided the issue by...
Read more >Customize a reusable React dropdown menu component
But just by looking the code, I saw that it is not working as it should. A custom select should be accessible through...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@kerbs17 it’s about selection using keyboard (: I see in the gif attached you use a mouse
Interesting, I’m using your provided stackblitz url and it doesn’t work in Chrome, FF, or Safari on my Mac.