Punctuation is cool, we should use it and improve legibility of interfaces.

Before

Core taxonomy dashes

After

Comparison screenshot in different browsers on mac OS

Affected

  • Taxonomy select
  • Menu parent select
  • Book outline select
CommentFileSizeAuthor
#74 2384203-improve-indentation-hierarchical-select-lists-74.patch12.38 KBkosa ilma
#63 after_patch_9.5.x-dev.mp4320.31 KBrkoller
#63 before_patch_10.1.x-dev.mp4328.05 KBrkoller
#61 2384203-improve-indentation-hierarchical-select-lists-61.patch9.56 KBMunavijayalakshmi
#49 After_Book.png138.75 KBpriyanka.sahni
#49 After_Book_D9.png194.55 KBpriyanka.sahni
#49 After_ParentMenulink.png1.08 MBpriyanka.sahni
#49 After_ParentMenuLink_D9.png720.71 KBpriyanka.sahni
#49 After_Taxonomy.png56.62 KBpriyanka.sahni
#49 After_Taxonomy_D9.png47.72 KBpriyanka.sahni
#49 Before_ParentMenulink.png1 MBpriyanka.sahni
#49 Before_Book.png152.44 KBpriyanka.sahni
#49 Before_Taxonomy.png62.45 KBpriyanka.sahni
#45 2384203-45.png25.36 KBbaluertl
#36 Screenshot_2019-05-01 Edit Recipe Fiery chili sauce Umami Food Magazine.png8.75 KBsysosmaster
#35 2384203-improve-indentation-hierarchical-select-lists-34.patch9.45 KBbaluertl
#33 2384203-improve-indentation-hierarchical-select-lists-33.patch9.45 KBbaluertl
#32 2384203-improve-indentation-hierarchical-select-lists-32.patch9.45 KBbaluertl
#31 2384203-improve-indentation-hierarchical-select-lists-31.patch9.29 KBbaluertl
#29 2384203-improve-indentation-hierarchical-select-lists-29.patch8.95 KBbaluertl
#27 2384203-improve-indentation-hierarchical-select-lists-27.patch7.85 KBbaluertl
#27 2384203-improve-indentation-hierarchical-select-lists-27_book-module-27.png39.68 KBbaluertl
#26 2384203-core-proper-dash-indentation-marked-26.png164.33 KBbaluertl
#26 2384203-core-proper-dash-only-whitespace-26.png13.46 KBbaluertl
#26 2384203-core-proper-dash-only-whitespace-26.png13.46 KBbaluertl
#26 2384203-core-proper-dash-wider-dashes-26.png80.63 KBbaluertl
#15 interdiff.txt606 bytesnod_
#15 core-proper-dash-2384203-15.patch7.72 KBnod_
#12 core-proper-dash-2384203-12.patch7.01 KBnod_
#4 core-proper-dash-2384203-4.patch4.67 KBnod_
taxonomy-core.png12.51 KBnod_
taxonomy-dash.png14.23 KBnod_
core-proper-dash.patch3.98 KBnod_

Issue fork drupal-2384203

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nod_’s picture

Issue summary: View changes
nod_’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, core-proper-dash.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new4.67 KB
wim leers’s picture

Issue tags: +Needs usability review

Wouldn't it then be better to use the "box drawing" Unicode characters?

So instead of

one
— oneone
— onetwo
—— onetwoone
— onethree
two
three

you'd end up with

one
┣ oneone
┣ onetwo
┣━ onetwoone
┗ onethree
two
three

… but let's look at something more complex, where we can choose to handle deeper levels in one of several ways:

one
┣ oneone
┣ onetwo
┣━ onetwoone
┗ onethree
two
┣ twoone
┣ twotwo
┣━ twotwoone
┣━ twotwotwo
┣━ twotwothree
┗ twothree
three

or even:

one
┣ oneone
┣ onetwo
┣━ onetwoone
┗ onethree
two
┣ twoone
┣ twotwo
┗┳ twotwoone
  ┣ twotwotwo
┏┻ twotwothree
┗ twothree
three
wim leers’s picture

Issue summary: View changes
nod_’s picture

Well, you want to make the possibly painful formatting function for it ? :D it's a simple fix that could go in fast. I would rather have a full blown solution as a follow-up.

I just want an easier way to differentiate levels.

betarobot’s picture

I think that "box drawing" #5 will be a bit of overload but more importantly may look nasty with quite so many web fonts (with optimised or stripped character sets especially).

Then think about all possible CSS styles, line heights etc. etc...

wim leers’s picture

#8: good point! Let's go with #4.

Status: Needs review » Needs work

The last submitted patch, 4: core-proper-dash-2384203-4.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new7.01 KB

Reroll + changed the menu selector and book selector do have the same – instead of --.

nod_’s picture

Title: Use an em dash (and space) in taxonomy tree select lists » Use an em dash (and space) in hierarchical select lists
Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 12: core-proper-dash-2384203-12.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new7.72 KB
new606 bytes

fixing tests

Status: Needs review » Needs work

The last submitted patch, 15: core-proper-dash-2384203-15.patch, failed testing.

kopeboy’s picture

Please provide the possibility to choose the character at least in D8!!

I still don't know how to hide horrendous dashes in my hierarchical views exposed filters..
On admin interface is ok, but on a long select field for site users, searchable with js (Chosen in D7), is often stupid / ugly.

Bojhan’s picture

Issue tags: -Needs usability review

I am not really sure if I can form an opinion on this. The dash and spaces look much more cleaner.

The box characters is interesting, but I am doubtful about its rendering in other browsers and accessibility.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

baluertl’s picture

Version: 8.6.x-dev » 8.8.x-dev
Status: Needs work » Needs review

I pick up this one trying move forward to get into the 8.8 release hopefully. First I tried to use the patch from #15 to see if it works on 8.8.x-dev version?

Result of $ git apply ~/Desktop/core-proper-dash-2384203-15.patch can be broken down to that 9 files, sorted into separate cases:

Patch failed as it does not apply

  1. core/lib/Drupal/Core/Menu/MenuParentFormSelector.php: at line :72
  2. core/modules/book/src/BookManager.php: at line :367
  3. core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php at line :189

No such file or directory

  1. core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php: phrase "TaxonomyTermReferenceItem" does not coin up in code repository indeed.
  2. core/modules/taxonomy/src/Plugin/entity_reference/selection/TermSelection.php: file still exists, but containing directory names has been condensed from "entity_reference/selection/" into single "EntityReferenceSelection".
  3. core/modules/taxonomy/src/Tests/Views/TaxonomyIndexTidUiTest.php: file still exists, but containing directories has been changed from "src/Tests/Views/" to "tests/src/Functional/Views/".
  4. core/modules/views_ui/src/Tests/DisplayPathTest.php: file still exists, but containing directories has been changed from "src/Tests/" to "tests/src/Functional/".

Error message does not mention (because modifications apply cleanly)

  1. core/modules/forum/src/Form/ForumForm.php
  2. core/modules/taxonomy/src/TermForm.php
baluertl’s picture

We may want to consider using U+2015 Horizontal bar (rendered like this: "―") which seems wider in terms of character space than the regular em dash:
Comparison screenshot in different browsers on mac OS

Although issue title mentions "dash" (probably because using them is a good-old pattern burned in Drupal UI's history), however, we don't need to stick with these horizontal lines for proper indentation. Of course, we cannot use regular space character (because web browsers' render engines will filter them out when graphically rendering the inner text nodes of <option> items. Instead, we can freely use U+2003 Em space, which is the widest I found in the collection of all space separators listed:
Screenshot

If we do this, then one concern may raise is that the user could find hard to overview the level of indentation. Especially on such a deep level as an Administration menu can be.

So in this case we could combine a tiny point (eg. U+00B7 Middle dot character) with the wide whitespace from above. As middot has a relatively low numeric position (No. #183) then probably most devices, including old ones or IE-equipped will be able to render with their fonts available. (This is the reason why I not recommend the very similar-looking U+2027 Hyphenation point or U+22C5 Dot operator characters, because their codepoints are much higher: #8231 and #8901 respectively. Chances that these may fall into "exotic" consideration on a given OS platform blocking their proper rendering.)
Comparison screenshot in different browsers on mac OS

If we agree to go towards this direction, then the formerly single-char separator matures into a string of two characters, like in the code example below from core/lib/Drupal/Core/Menu/MenuParentFormSelector.php:

...
if (!empty($element->subtree)) {
  $this->parentSelectOptionsTreeWalk($element->subtree, $menu_name, $indent . '· ', $options, $exclude, $depth_limit, $cacheability);
}
...

This way that would be elegant to organize these two chars into a proper PHP-variable of string, so we could refer it from multiple places for the sake of consistency. And maybe @kopeboy's idea could also be closer to implement.

baluertl’s picture

Title: Use an em dash (and space) in hierarchical select lists » [patch] Improve indentation in hierarchical select lists
Category: Bug report » Task
StatusFileSize
new39.68 KB
new7.85 KB

Also tested with the Book module's outline lists:
Screenshot

Based on @nod_'s patch from #15 I followed the same files to port these improvements to 8.8.x-dev version. The only one file in his patch that I was not able to dig up in 8.8.x code structure is the old /core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php. Any hints would be appreciated to figure out if it still exists or not? And I also tried to search for str_repeat('- in the core/ directory to see if I can find more hierarchical lists, but it seems like that's all.

Status: Needs review » Needs work
baluertl’s picture

Status: Needs work » Needs review
StatusFileSize
new8.95 KB

Test assertions updated regarding previous results.

Status: Needs review » Needs work
baluertl’s picture

Status: Needs work » Needs review
StatusFileSize
new9.29 KB

I found the reason of the failure: an extra space character was added later in parentSelectOptionsTreeWalk() method. Now removed, let's see!

baluertl’s picture

StatusFileSize
new9.45 KB

As @sysosmaster pointed out on DrupalChat.me, these Unicode characters should be referenced properly by their numeric codepoints instead of directly put them into PHP files in their pure form. And PHP 7 offers (see release notes and documentation) built-in support to handle them on its "native" level (our internal Drupal\Component\Utility\Unicode class is not needed for this, I think). So here's an updated patch provided.

baluertl’s picture

StatusFileSize
new9.45 KB

Interesting, on local repo it applies cleanly. Anyway, search & replaced "core/lib/Drupal/core" to "core/lib/Drupal/Core" in paths.

Status: Needs review » Needs work
baluertl’s picture

Status: Needs work » Needs review
StatusFileSize
new9.45 KB

Silly mistake, I forgot to replace single quotes to double ones, sorry.

sysosmaster’s picture

2384203-improve-indentation-hierarchical-select-lists-34.patch Code reviewed by me.
Code change in patch looks OK to me.

Visually it looks like this for me
screenshot
I am not sure thats whats proposed but if it is it can be RTBC'd

nod_’s picture

The dots are growing on me. Thanks for picking up and improving the patch!

amateescu’s picture

@Balu Ertl,

The only one file in his patch that I was not able to dig up in 8.8.x code structure is the old /core/modules/taxonomy/src/Plugin/Field/FieldType/TaxonomyTermReferenceItem.php. Any hints would be appreciated to figure out if it still exists or not?

That code is now in \Drupal\taxonomy\Plugin\EntityReferenceSelection\TermSelection::getReferenceableEntities(), which you already updated in the patch :)

baluertl’s picture

@amateescu thanks for the hint! Glad to hear that it's already covered :)

baluertl’s picture

Title: [patch] Improve indentation in hierarchical select lists » Improve indentation in hierarchical select lists

Removing meaningless "[patch]" prefix from issue title.

ckrina’s picture

Issue tags: +Needs usability review

Since the last UX review was 4 years ago, it'll probably need another review. Tagging it to check it.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

nicholass’s picture

Using the dot indention I believe is the cleanest solution. It has clear and consistent left indentation and has less visual weight than the — character so the eye can focus on the text (what a user is looking for).

Only thing I would love added is to construct a breadcrumb like trail above the select box to display the current hierarchy so a user does not have mentally assemble this based on the analyzing the visual levels. I image this can be done in JavaScript best. Maybe its best left for a module to progressively enhance the core hierarchical select boxes?

nicholass’s picture

Removed Duplicate post - Sorry Drupal having 500 errors

baluertl’s picture

StatusFileSize
new25.36 KB

Now tested with Drupal core 8.8.0-beta1 and Claro theme has not addressed yet this issue in any other way:

Screenshot

So I think we should deliver some solution, so let's commit in patch #34, please.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

xjm’s picture

priyanka.sahni’s picture

Assigned: Unassigned » priyanka.sahni

Working on it

priyanka.sahni’s picture

StatusFileSize
new62.45 KB
new152.44 KB
new1 MB
new47.72 KB
new56.62 KB
new720.71 KB
new1.08 MB
new194.55 KB
new138.75 KB

Verified and tested by applying the patch on Drupal 8.9 and 9.It was working as expected.It looks good to me.

Steps to test -
1. Go to the admin site.
2. Go to admin/modules.
3. Enable the Simple hierarchical select , book and menu ui modules.
4. Go to admin/structure/taxonomy/manage/tags/add.
5. Add some taxonomy and verify parent terms.
6. Go to admin/structure/menu/manage/admin/add?destination=/drupal8.9/admin/structure/menu.
7. Add some menu link and verify parent link.
8. Go to /node/add/book.
9. Add some book and verify parent item.

Before_Taxonomy -
BeforePatch

Before_Book -
BeforePatch

Before_ParentMenulink -
BeforePatch

After_Taxonomy_D8.9 -
After Patch

After_Taxonomy_D9 -
After Patch

After_ParentMenulink_D8.9 -
After Patch

After_ParentMenulink_D9 -
After Patch

After_Book_D8.9 -
After Patch

After_Book_D9 -
After Patch

priyanka.sahni’s picture

Assigned: priyanka.sahni » Unassigned
baluertl’s picture

@priyanka.sahni thanks for thorough testing and documenting with screenshots!

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

hexabinaer’s picture

So is this really still waiting for review?

baluertl’s picture

@hexabinaer Indeed ticket apparently stuck in “Needs review” status. If you agree with the changes, feel free to toggle to RTBC.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

anybody’s picture

Who from the Drupal Core team could have a look at this? Just found it and think it would still be a helpful improvement. Could / should we ping someone from the UX team for feedback?

nod_’s picture

We'd need to update the issue summary with the latest screenshot, and make sure the patch still applies

Munavijayalakshmi’s picture

Assigned: Unassigned » Munavijayalakshmi
Status: Needs review » Needs work
Munavijayalakshmi’s picture

Assigned: Munavijayalakshmi » Unassigned
Status: Needs work » Needs review
StatusFileSize
new9.56 KB

#34 patch failed.
Re-rolled patch #34 (branch-9.5.x).

Status: Needs review » Needs work
rkoller’s picture

Issue tags: +Accessibility
StatusFileSize
new328.05 KB
new320.31 KB

i've applied the patch in #61 to a 9.5.x-dev install. in regards of accessibility i've noticed one significant problem that might entail some discussion and work. I've tested with a Menu parent select and Voiceover on MacOS (12.6) for one menu link in the administration menu.

first i've checked the current behavior in drupal 10.1.x-dev: https://www.drupal.org/files/issues/2022-09-22/before_patch_10.1.x-dev.mp4 - you get each option announced the prepended dashes are not.

i've then tested the patch on drupal 9.5.x-dev with the patch applied https://www.drupal.org/files/issues/2022-09-22/after_patch_9.5.x-dev.mp4 . as you notice the voiceover announcement prepends a comma right before each option. but no matter if there is one dot or three dots there is always a single comma announced upfront.

so in both cases the hierarchy of the the options is inaccessible - at least for Voiceover but it would be interesting what NVDA and Jaws are announcing with the patch applied. and with voiceover the single prepended comma that is announced provides no function and is more confusing than providing any queues to the screenreader user.

As already mentioned in the thread in the #ux channel on the drupal slack. the issue would be a real good topic for the next a11y office hour.

baluertl’s picture

Assigned: Unassigned » baluertl
baluertl’s picture

Issue summary: View changes
benjifisher’s picture

Version: 9.5.x-dev » 10.1.x-dev

Since the beta versions of 9.5.0 and 10.0.0 have been released, most issues should now target 10.1.x. @Balu Ertl, can you update the MR?

baluertl’s picture

Usability review

We discussed this issue at #3310096: Drupal Usability Meeting 2022-09-23. That issue will have a link to a recording of the meeting. For the record, the attendees at this usability meeting were @AaronMcHale, @Balu Ertl, @benjifisher, @dancbatista, @rkoller, @shaal, @simohell, and @worldlinemine. A quick recap of what we have discussed:

  1. As @rkoller pointed out, the latest patch causes screenreaders (at least macOS' VoiceOver utility which I tested with) adds a plus word “comma” in extra before saying the label of the actual option item.
  2. It can be considered as a regression compared to the currently implemented solution which does not add extra noise only the label is read purely.
  3. Ideally, the level of depth within the hierarchy should be also communicated somehow. Although it inherently increases code complexity. From this point on this ticket is also an a11y issue too.
  4. The practice of using non-ASCII Unicode characters was also challenged by the argument that they can be displayed in every case on every platform.
  5. However, we agreed that horizontal guidance is necessary for the human vision to let users easily connect the selection mark on the left (in the case of LTR writing direction) to the chosen label.
benjifisher’s picture

I think the next step for this issue is to improve the accessibility. At least do not make it any worse (see #63, #68); if possible, improve it.

Once that is done, we can decide exactly which character to use. The usability meeting agreed that the "after" screenshots were an improvement over the current version. Several attendees thought it was helpful to have the vertical and horizontal spacing be the same.

mgifford’s picture

Issue tags: +wcag144

I think this is a SC 1.4.4 issue.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mgifford’s picture

Even adding an HR would help.

Here's a useful guide to best practices as of 2023 - https://adrianroselli.com/2023/10/splitting-within-selects.html

alison’s picture

Hi all! Following up on a Slack conversation...

A "solution" some of my colleagues came up with -- not going to be a broadly helpful solution, but it might help some folks who come across this issue (note: see "Limitation" below!) --

TL;DR: We're using optgroup elements, and repeating the first/parent item, so that there's a "selectable" version of that parent item (optgroups themselves aren't selectable).

⚠️ Limitation: You can't nest optgroups, so this solution only works with one hierarchy-level, so to speak. As such, it isn't a solution for menus, and it won't work with "has taxonomy term (with depth)" situations with more than 2 depth levels. So, like I said, it's not going to be helpful for actually solving this broader issue, but I'm sharing anyway, in case it helps someone with a comparable use case!

-------

All the details are in this "optgroup demo" gist. (Let me know if you have any questions -- I'll see updates here, but the quickest way to reach me is on Drupal Slack: @alison)

kosa ilma’s picture

Patch for core 10.3.x

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.