title: R shiny selectInput(): multiple option groups not working with one option
body: <p>I am trying to make option groups in <code>selectInput()</code>, but seeing the following unexpected result.</p>
  
  <p>If you type the following line in your console:</p>
  
  <pre><code>selectInput("test", "I am test", choices = list("Group A" = c("a", "b", "c"), "Group B" = "d"))
  </code></pre>
  
  <p>You should see the following output:</p>
  
  <pre><code>&lt;div class="form-group shiny-input-container"&gt;
     &lt;label class="control-label" for="test"&gt;I am test&lt;/label&gt;
     &lt;div&gt;
        &lt;select id="test"&gt;
           &lt;optgroup label="Group A"&gt;
              &lt;option value="a" selected&gt;a&lt;/option&gt;
              &lt;option value="b"&gt;b&lt;/option&gt;
              &lt;option value="c"&gt;c&lt;/option&gt;
           &lt;/optgroup&gt;
           &lt;option value="d"&gt;Group B&lt;/option&gt;       &lt;====== wrong
        &lt;/select&gt;
        &lt;script type="application/json" data-for="test" data-nonempty=""&gt;{}&lt;/script&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The problem with the above code is, the <code>Group B</code> should be the <code>optgroup label</code> instead of <code>option text</code>. I imagine the above code should return the following:</p>
  
  <pre><code>&lt;div class="form-group shiny-input-container"&gt;
     &lt;label class="control-label" for="test"&gt;I am test&lt;/label&gt;
     &lt;div&gt;
        &lt;select id="test"&gt;
           &lt;optgroup label="Group A"&gt;
              &lt;option value="a" selected&gt;a&lt;/option&gt;
              &lt;option value="b"&gt;b&lt;/option&gt;
              &lt;option value="c"&gt;c&lt;/option&gt;
           &lt;/optgroup&gt;
           &lt;optgroup label="Group B"&gt;            &lt;====== correct
              &lt;option value="d"&gt;d&lt;/option&gt;       &lt;====== correct
           &lt;/optgroup&gt;                           &lt;====== correct
        &lt;/select&gt;
        &lt;script type="application/json" data-for="test" data-nonempty=""&gt;{}&lt;/script&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Is this expected? If not, how could I fix it?</p>