API page: https://api.drupal.org/api/drupal/core%21modules%21system%21templates%21...
The select.html.twig allows only one level of optgroups. HTML standards also allow the same. But when incorporating plugins like select2 or Chosen, allowing nested optgroups would help build features like "Deepest level taxonomy term select".
Altering the code in the following way would be of much help.
{% import _self as select %}
{% spaceless %}
<select{{ attributes }}>
{{ select.options(options) }}
</select>
{% endspaceless %}
{% macro options(options) %}
{% import _self as select %}
{% for option in options %}
{% if option.type == 'optgroup' %}
<optgroup label="{{ option.label }}">
{{ select.options(option.options) }}
</optgroup>
{% elseif option.type == 'option' %}
<option value="{{ option.value }}"{{ option.selected ? ' selected="selected"' }}>{{ option.label }}</option>
{% endif %}
{% endfor %}
{% endmacro %}
Will try and create a patch soon.
Active
11.0 🔥
documentation
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.