Problem/Motivation

Three small robustness problems, all on the repeated-attach path (AJAX, BigPipe, a form rebuild) plus one metadata correction:

  • Duplicate DOM ids. js/formatter.js numbers its injected display element from the index of the current attach call. once() only returns containers new to that call, so the index restarts at 0 and a container added later reuses an id already on the page.
  • Editors kept forever. js/editor.js keeps every editor in a module-level map and never removes the entry on detach, so destroyed editors stay referenced for the life of the page.
  • Core version requirement. ace_editor.info.yml declares ^10, but the code uses str_contains() and other API available from Drupal 10.1, so the declared minimum is lower than what actually runs.

Proposed resolution

  • Number the formatter's display elements from a page-wide counter that never repeats.
  • Delete the registry entry when an editor is destroyed on detach.
  • Declare ^10.1 || ^11 || ^12.

Remaining tasks

  • ✅ File an issue
  • ✅ Addition/Change/Update/Fix
  • ✅ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Accessibility and Readability
  • ❌ Reviewed by a human
  • ❌ Code review by maintainers
  • ❌ Full testing and approval
  • ❌ Credit contributors
  • ❌ Review with the product owner
  • ❌ Update Release Notes
  • ❌ Release

Release notes snippet

  • The formatter no longer reuses element ids when fields are added to a page after the first render, destroyed editors are released, and the module declares Drupal 10.1 as its minimum.

Issue fork ace_editor-3618897

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

rajab natshah created an issue. See original summary.

  • rajab natshah committed cbd7ae48 on 2.0.x
    fix: #3618897 Keep element ids unique across attaches and release...
rajab natshah’s picture

Status: Needs review » Fixed

Fixed on 2.0.x.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

rajab natshah’s picture

Issue tags: +ace_editor-2.0.4

✅ Released ace_editor-2.0.4

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.