fix: #3618897 Keep element ids unique across attaches and release destroyed editors

Fixes #3618897.

Three robustness fixes on the repeated-attach path plus one metadata correction:

  • js/formatter.js numbered its injected display element from the index of the current attach call; once() only returns containers new to that call, so the index restarted at 0 and a container added later (AJAX, BigPipe, form rebuild) reused an id already on the page. It now uses a page-wide counter.
  • js/editor.js kept every editor in a module-level map and never removed the entry on detach; the destroyed editor is now dropped from the registry.
  • ace_editor.info.yml declared ^10 while the code uses API available from Drupal 10.1 (str_contains()); it now declares ^10.1 || ^11 || ^12.

Verification

eslint PASS; local gate 68 tests / 214 assertions, phpcs, cspell, PHPStan clean. The formatter counter is monotonic by construction, so ids cannot repeat within a page.

Checkpoints:

  • File an issue
  • Addition/Change/Update/Fix
  • Testing to ensure no regression
  • Automated unit testing coverage
  • Automated functional testing coverage
  • UX/UI designer responsibilities
  • Readability
  • Accessibility
  • Performance
  • Security
  • Developer Documentation
  • User Guide Documentation
  • Reviewed by human
  • Code review by maintainers
  • Full testing and approval
  • Credit contributors
  • Review with the product owner
  • Release notes snippet
  • Release

AI-Generated: Yes

Edited by Rajab Natshah

Merge request reports

Loading
Loading