Problem/Motivation
I ran into two bugs on 2.x right after installing the module.
First, with Installation method set to Local library, SettingsForm::submitForm() saves libraries/accessible-menu/dist/... without a leading slash. Drupal treats a library path with no leading slash as relative to the module directory, so the browser requests /modules/contrib/accessible_menu/libraries/accessible-menu/dist/accessible-menu.iife.js and 404s.
Second, the config schema keys for menu and block settings are system.menu.*.third_party_settings.accessible_menu and block.block.*.third_party_settings.accessible_menu with type: config_object. Core looks up third-party settings under third_party, not third_party_settings, and expects type: mapping. Saving a menu or block with Accessible Menu settings logs missing schema errors, fails config inspection, and throws SchemaIncompleteException in kernel tests with strict schema. The Bootstrap 5 submodule (accessible_menu_bootstrap_5.schema.yml) has the same two mistakes.
Steps to reproduce
For the library path:
- Put the library in
/libraries/accessible-menu. - Go to Configuration > Development > Accessible Menu Settings (
/admin/config/development/accessible-menu), set Installation method to Local library, and save. - Load a page with an accessible menu. The script request 404s.
For the schema:
- Edit any menu, set an Accessible Menu type, and save.
- Run
drush config:inspect --only-error(config_inspector), or save the menu in a kernel test. - You get
system.menu.<id>:third_party_settings.accessible_menu.* missing schema.
Proposed resolution
Prefix the local library and menu type paths with / in SettingsForm::submitForm() so they resolve from the Drupal root, and rename the schema keys to system.menu.*.third_party.accessible_menu and block.block.*.third_party.accessible_menu with type: mapping in both the main module and the Bootstrap 5 submodule. The schema change doesn't alter stored config.
Sites that already saved Local library will need to save the settings form once. I can add a post-update hook for that if you'd prefer.
I'm opening an MR against 2.x. Since the module has no test suite, I checked both fixes locally on Drupal 11.4 with PHP 8.5 (SQLite) using a scratch kernel test with the Bootstrap 5 submodule enabled. Before the fix, saving a menu or block threw SchemaIncompleteException and submitting the settings form saved libraries/accessible-menu/...; with the fix, both saves pass strict schema and library discovery resolves /libraries/....
Remaining tasks
- Review MR
- Decide whether to add a post-update hook for saved Local library paths
I used AI tools to help track this down and draft the fix; I reviewed and tested it myself.
Issue fork accessible_menu-3641684
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
Comment #3
teppy commented