syntax-tree/hast-util-to-mdast

Should `<select>`, `<datalist>`, `<option>`, and `<optgroup>` render lists?

wooorm opened this issue · 2 comments

Questions

See below for examples, but first two notes:

  • What to do with [disabled]?
  • Should these lists always render with checkboxes?
  • ...probably a lot more

Examples

For example, this HTML:

<label>
  Choose a browser from this list:
  <input list="browsers">
</label>
<datalist id="browsers">
  <option value="Chrome">
  <option value="Firefox">
  <option value="Internet Explorer">
  <option value="Opera">
  <option value="Safari">
  <option value="Microsoft Edge">
</datalist>

...could be rendered like:

Choose a browser from this list:

* Chrome
* Firefox
* Internet Explorer
* Opera
* Safari
* Microsoft Edge

...and:

<p>
  And these:
  <select>
    <option value="value1">Value 1</option>
    <option value="value2" selected>Value 2</option>
    <option value="value3">Value 3</option>
  </select>
</p>

could be:

And these:

* [ ] Value 1
* [x] Value 2
* [ ] Value 3

...and:

<p>
  Check out these options:
  <select>
    <optgroup label="Group 1">
      <option>Option 1.1</option>
    </optgroup>
    <optgroup label="Group 2">
      <option>Option 2.1</option>
      <option>Option 2.2</option>
    </optgroup>
    <optgroup label="Group 3" disabled>
      <option>Option 3.1</option>
      <option>Option 3.2</option>
      <option>Option 3.3</option>
    </optgroup>
  </select>
</p>

could be:

Check out these options:

* Group 1
  * Option 1.1
* Group 2
  * Option 2.1
  * Option 2.2
* Group 3
  * Option 3.1
  * Option 3.2
  * Option 3.3

Other form elements are interesting too! What about radio groups? Checkboxes? Fieldsets, labels, inputs, text areas?

Not doing this, although it would be nice, but it would mean breaking out of the paragraph and creating a new sibling list.