First thank you for this great module!

Description:

I am experiencing an issue with the Simple Hierarchical Select (SHS) module in Drupal 11.1.1. Although the module is correctly installed and configured, I am unable to create new taxonomy terms when using the field.

Steps to Reproduce:

  1. Install Drupal 11.1.1 and the Simple Hierarchical Select module (version 3.0.0-alpha4).
  2. Create a field that uses the SHS widget and references a taxonomy vocabulary.
  3. Enable the "Allow creating new items" option in the field settings.
  4. Attempt to add a new term while editing content.

Expected Behavior:
A new taxonomy term creation button should appear when trying to create a new item.

Actual Behavior:

No option to create a new taxonomy term is available during content editing. The module generates no errors in the log.

Additional Information:

  • Drupal Version: 11.1.1
  • SHS Module Version: 3.0.0-alpha4
  • PHP Version: 8.3
  • I have verified that all settings are correct, and the issue persists across multiple vocabularies.
  • Windows 10 Home
  • Chrome Version 132.0.6834.84 (Offizieller Build) (64-Bit

Issue fork shs-3500391

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

mp created an issue. See original summary.

joseph.olstad’s picture

Version: 3.0.0-alpha4 » 3.0.0-beta2
Status: Active » Postponed (maintainer needs more info)
mp’s picture

Still doesn´t work, when i press the button "Add new" i get an error message at console:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

1 source
jquery.min.js:2

Not sure if the module security kit, which i use, has some effect to this

joseph.olstad’s picture

Might be related to Drupal 11.1.1 which uses jQuery 4

probably related to the module security kit

With that said, feel free to upload a patch if you figure this out.

mp’s picture

thanks for the info

I´m a frontend dev, not able to write a patch, but will try to get it to run with AI help, maybe I´m lucky ;)

joseph.olstad’s picture

You'll want to replace that jquery.min.js with jquery.js

minified is difficult to work with

mp’s picture

in Line 213 instead of "async: false," write "async: true,"
This brings me a step further but it is only possible to add new terms when there are already terms on this level. Does a Level1 term have no Level2 terms then the input-field and the "Add new" button doesn´t appear. Only if there are already Level2 terms (manually added before). ChatGPT and Claude were not able to fix that :)

joseph.olstad’s picture

line 213 of what?

joseph.olstad’s picture

try uninstalling the "module security kit" , undo your changes, rebuild caches and then see what happens.

joseph.olstad’s picture

Is this the module you're using? https://www.drupal.org/project/seckit ?

mp’s picture

sorry, forgot to mention the file, it's shs/js/views/WidgetView.js

yes, using https://www.drupal.org/project/seckit
removed Security Kit and cleared all caches via browser and drupal - no effekt

mp’s picture

StatusFileSize
new3.9 KB
new3.53 KB

I managed to fix the error with AI and added a new feature.

About the new feature, it is a new setting in the widget settings that you can set a maximum hierarchy level, for example 3 levels. Example animals - Genus, Species, Subspecies, there can be only 2 levels (Genus + Species) or also 3 levels (Genus + Species + Subspecies). If there are 3 levels and someone chooses on the last allowed level a term then the input field and "Add new" button disappear. Is there still the default "- Select a value" in the dropdown then you can add more terms on this level.
I tested it and it worked for me, but more test runs would be helpful to verify.

btw, i have no clue how to make a patch, i added the files as zip files
/shs/js/views/WidgetView.js
/shs/src/Plugin/Field/FieldWidget/OptionsShsWidget.php

joseph.olstad’s picture

Thanks, someone can take that and make a patch with it, this is for 3.0.x latest version right? I'm hoping you used the latest code before making the patch, if not, will sort it out.

joseph.olstad’s picture

Version: 3.0.0-beta2 » 3.0.0-beta3
joseph.olstad’s picture

How to make a patch

@mp, for this time, it's great, thanks for your upload, for next time, you may be interested in learning how to write a patch. I've included the link to the documentation on this. There's even a video giving a demo.

mp’s picture

@joseph.olstad
yes, I used the latest code and thanks for the link, will look into how to make a patch

mp’s picture

hi, status is "Postponed (maintainer needs more info)" - which informations do you need? how can i help?

rozzi’s picture

I see no create new item button despite my role having a Create terms permission and every other taxonomy-related permission. Allow creating new items is enabled for the field form. There is only one hierarchy level in that particular vocabulary composed of 13 pages of items. Using 3.0.0-beta4 on the latest Drupal 11.

mp’s picture

@rozzi I think my patch is not included in 3.0.0-beta4 and @joseph.olstad gave me no feedback yet if he needs more informations.
You can try beta3 and use my modifications - works very well :)

joseph.olstad’s picture

@mp, still waiting for your patch, that's what is holding this up. Please see comment #15, I left instructions on how to generate a patch. I haven't had time to discern what your zip file is about. A patch or merge request is required.

mp’s picture

StatusFileSize
new21.06 KB
new20.35 KB

@joseph.olstad sorry, that was a misunderstanding, thought someone else will do it :) ... I added 2 patches for beta3 and beta4, both are not tested yet

joseph.olstad’s picture

Assigned: Unassigned » joseph.olstad
Status: Postponed (maintainer needs more info) » Active

joseph.olstad’s picture

joseph.olstad’s picture

Version: 3.0.0-beta3 » 3.0.0-beta4
Assigned: joseph.olstad » Unassigned
Status: Active » Needs work

Need to fully understand the changes and evaluate what changes and or automated testing changes may need to be done.

@mp , the automated tests no longer jive with these changes. It will take some time to evaluate this.

joseph.olstad’s picture

Status: Needs work » Needs review
joseph.olstad’s picture

Hmm, ok test failures could be caused by 11.2.x
running new tests.

joseph.olstad’s picture

ok , test failures are due to the code changes. It's likely the automated tests need to be re-aligned for the updated functionality.

With that said, someone needs to review the patch file from MR 44 and explain the changes, review the changes and confirm that this is correct.