title: React - Prevent focus going out of modal when tabbing
body: <p>I have built a react modal on my own. When I press tab key while the modal is opened, the focus still goes to the background page. How to restrict the focus within the components inside the modal?</p>
  
  <p>What should be the logic below?</p>
  
  <pre><code>onKeyPress (e) {
     if (e.keyCode === 9) {
         e.preventDefault();
        // logic here?
     }
  }
  </code></pre>
  
  <p>React Modal code:</p>
  
  <pre><code>&lt;ReactModal onKeyPress={this.onKeyPress} &gt;
     &lt;input type="text"/&gt;
     &lt;input type="text"/&gt;
  &lt;/ReactModal&gt;
  </code></pre>