title: JavaScript, allow the user to only focus on certain page elements?
body: <p>In jQuery-UI-Dialog allows me to display a 'modal' dialog box on my web page so that the user must click an option in the dialog to proceed.</p>
  
  <p>I've been writing my own dialog box code, but there is something that jQuery-UI-Dialog does that I don't know how to do yet.</p>
  
  <p>I am able to display a "mask" element behind the dialog to prevent the user from clicking on elements on the page, but the user can still select elements behind the dialog using the tab key.</p>
  
  <p>The jQuery-UI-Dialog seems to somehow trap the keyboard input inside the dialog box even when the tab key is pressed.  This is very neat, but I will add that it could be abused.</p>
  
  <p>What aspect of the DOM do I need to access to get this functionality?</p>