fix: #3628260 Fix Bootstrap 5 dropdown keyboard handling in accessible menus

Issue

https://www.drupal.org/project/accessible_menu/issues/3628260

Changes

Initialize the Bootstrap adapter's native-dropdown cancellation before user input. Set the controlling data attribute for top-level and nested toggles, and prevent subsequent native show events from overriding Accessible Menu's expanded state. This uses the public Bootstrap instance API and the adapter's existing cancellation behavior; it does not modify Bootstrap internals.

The guard leaves standalone menus, absent Bootstrap JavaScript, and disableBootstrap: false unchanged. Drupal once prevents repeated attachment from creating duplicate handlers.

Verification

  • Exact source commit: 013241f1.
  • Issue-fork CI passed, including 14 real-Chromium browser tests.
  • Identical tests against the unchanged 1.x base (022feda4): 8 passed, 4 failed. Both Bootstrap 5.1.3 and 5.3.8 reproduce the keyboard exceptions; the initial candidate passed 12/12.
  • Tests cover one-step arrow navigation, Home/End/Escape, nested toggles, repeated clicks/Enter, repeated Drupal attachment, unrelated native Bootstrap dropdowns, all four adapter menu types' initialization/pointer behavior, and standalone/disabled-integration controls.
  • Fresh Drupal 11.4.8 Minimal + SQLite, with the separate Bootstrap Cloud integration fix: 85 desktop/responsive/multilingual checks and 13 emulated-touch/resize checks passed. No JavaScript or asset errors. Languages: en, ja, zh-hans, th; viewport range: 320–1440px.
  • Reproduce the committed suite with npm ci, npx playwright install --with-deps chromium, and npm test.

Scope and limitations

Targets the stable 1.x line. Theme styling is not included here. Touch checks use browser emulation, not physical-device or screen-reader testing. A reversible preview of this unmerged change is deployed to i.pixie.works for user validation; no release, merge, or issue closure was performed.

Late Bootstrap load and production preview

The production theme loads the Accessible Menu generator before its Bootstrap bundle. The previous candidate failed the two new loading-order browser tests (12 pass, 2 fail); the updated branch passes all 14 with Bootstrap 5.1.3 and 5.3.8. On the 2026-10-03 production preview, Tags opens on click, Tab reaches its submenu and Escape closes it. The theme-side change remains separate in Bootstrap Cloud MR!92. The previous production image and Compose file are retained for rollback.

Edited by AI Yas

Merge request reports

Loading
Loading