title: Is there a way to determine if a <select> dropdown menu is open?
body: <p>I'm looking for a way to determine if/when a <code>&lt;select&gt;</code> element's menu is open. I don't need to force it to open or close, just figure out if it's open or closed at a given time.</p>
  
  <p>I can listen to events for focus/blur, mouseup/mousedown, etc., but I don't think I can reliably figure out the state of the menu from those events. For example, mousedown followed by mouseup could mean the user clicked and dragged to a selection and released (in which case the menu is now closed) or clicked and released to open the menu (in which case the menu is open). It also seems likely that the specific behavior of dropdown menus is browser-dependent.</p>
  
  <p>I know I could do this if I roll my own dropdown menu, but I prefer to use <code>&lt;select&gt;</code>.</p>
  
  <p>Is there a reliable way to find out if a dropdown menu is open? Or is this something that Javascript can't know?</p>
  
  <p>Conclusion: There doesn't seem to be any guaranteed way to determine if a select menu is open, either by asking the object or by listening to the events it fires.</p>
  
  <p>For my own use I'm just keeping track of whether the select has focus using <i>onfocus</i> and <i>onblur</i>. I'm assuming there's no way for the menu to be open without having focus, and that seems to hold true in all the browsers I've tested. It doesn't actually tell me when the menu is open, but it tells me when it <i>can't</i> be open, which is good enough for my purposes.</p>