title: How would one close previously opened NgbDropdowns when new NgbDropdowns are opend using the enter key?
body: <p>I'm a newbie to NgbDropdown and related ng-bootstrap code, and I'm having trouble figuring out how to close all previous NgbDropdowns when a new one is opened using the enter key.</p>
  
  <p>I've created a number of NgbDropdowns on a page in my Angular project, and I find that when I click from dropdown button to dropdown button, the previously opened dropdown closes; however, if I TAB from an open dropdown to another dropdown button and use the enter key to open the second dropdown, as may be needed for accessibility, the first dropdown does NOT close. I am left with two drop-downs overlaying each other. </p>
  
  <p>This sequence can be duplicated on the main NgbDropdown example page at <a href="https://ng-bootstrap.github.io/#/components/dropdown/examples" rel="nofollow noreferrer">https://ng-bootstrap.github.io/#/components/dropdown/examples</a>: on a different button (First example at the top.)</p>
  
  <p>Sequence:
   1. Tab to "Toggle Dropdown" 
   2. Hit the enter key to open the dropdown 
   3. Tab through the dropdown options, pluse one more time, so that you've
      tabbed to the "toggle drop-up" button. 
   4. Hit the enter key
   5. Both dropdowns will be open simultaneously.</p>
  
  <p><a href="https://i.stack.imgur.com/3IzfA.jpg" rel="nofollow noreferrer">Screen Shot</a></p>
  
  <p>So apparently the code that closes previous dropdowns on click doesn't work when the enter key is pressed on a different button. Not finding much documentation about what can be done with the various Ngb objects in typescript, I am left not knowing how to close all previous dropdowns when a new dropdown is opened with the enter key. All I can think of doing is:</p>
  
  <p>1) Loop over all dropdowns in the ts file, closing them prior to opening the latest. If this is the best solution, I do not see any way to loop over a collection of open drop-downs. Is there such an object/array available to me as part of the NgbSolution, or would I have to add each to an array on my own?</p>
  
  <p>2) Trigger the click event when the enter key is pressed on a button. Again, I am unaware of how to have one event trigger another on an NgbDropdown object.</p>
  
  <p>Any pointers would be appreciated. I've not posted my code here because it is the same as the basic example referenced above.</p>