Review main Merged

93511[BUGFIX] Fix crash when deleting unselected form element in Form Editor

Josua Vogel CR +2 V +2 Easy +4 −4 updated 04/02/26, 06:17

Commit message

The root cause is a timing issue in the JavaScript event loop. The
toolbar's custom event (`toolbar-remove-element`) is dispatched
synchronously during the original click event's target phase and bubbles
before the original click continues propagating to the stage container.
This means `showRemoveFormElementModal()` is called – and the reference
to the form element is frozen into the confirmation dialog – *before*
the stage click handler fires and updates `currentlySelectedFormElement`.

On initial page load and after every save operation, the root form
element is set as the currently selected element. Because the root
element has `__parentRenderable === null`, the `assert` check inside
`Repository.removeFormElement()` throws when the user confirms the
dialog.

Pass `formElement` explicitly to
`showRemoveFormElementModal()` in all three toolbar event-listener
sites in stage-component.ts:
- `renderFormElementStageItem()` (web-component path)
- `wireAbstractViewFormElementToolbarEventListeners()` (legacy path)
- `createAndAddAbstractViewFormElementToolbar()` (legacy path)

Review

  • Code review CR +2 Done
    • Benjamin Kott +2
    • Andreas Kienast +1
  • Verified V +2 Done
    • Benjamin Kott +2
    • Andreas Kienast +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 45

  1. Josua Vogel uploaded patch set 1 04/01/26, 11:55

  2. core-ci voted on patch set 1 V +1 04/01/26, 12:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99395

  3. Andreas Kienast voted on patch set 1 CR +1 V +1 04/02/26, 06:16

  4. Benjamin Kott voted on patch set 1 CR +2 V +2 04/02/26, 06:17

  5. Benjamin Kott merged patch set 2 04/02/26, 06:17