Issue Bug New Quiet

#110947Send to stage modal is empty when workspace preview is opened inside the "View" module

m s 10/07/26, 08:16 updated 10/07/26, 08:16

Description

Problem/Description
—————————-
When the workspace split preview (route `workspace_previewcontrols`) is rendered
inside the backend “View” module (Web > View), clicking “Send to stage …” opens a
modal with an empty body (no “Comments” textarea). “OK” does nothing, only
“Cancel” works. The console shows:

Uncaught TypeError: can’t access property “querySelectorAll”, r is null
convertFormToObject typo3/backend/utility.js
renderSendPageToStageWindow
typo3/workspaces/preview.js
_buttonClick @typo3/backend/modal.js

When the same preview is opened standalone in its own browser tab, the dialog
renders correctly and works.

The AJAX response of `sendPageToNextStage` is correct (contains `comments`,
`affects`, `stageId`), so this is a client-side issue only.

Steps to reproduce
—————————
1. Create a workspace (default stages are sufficient) and switch to it.
2. Reload the backend. Do NOT open the “Workspaces” module.
3. Modify a content element on a page.
4. Open that page in the “View” module. The workspace preview with the
“Send to stage” button is shown inside the module.
5. Click “Send to stage “Ready to publish”“.

Expected: Modal with “Comments” textarea, “OK” sends the records to the stage.
Actual: Empty modal, “OK” throws the TypeError above.

Root cause
—————
- backend.ts (Workspaces module) registers the form element in the top frame:
topLevelModuleImport(‘@typo3/workspaces/renderable/send-to-stage-form.js’);
- preview.ts only imports it locally:
import ‘@typo3/workspaces/renderable/send-to-stage-form’;
so <typo3-workspaces-send-to-stage-form> is defined only in the<br> CustomElementRegistry of the preview iframe.<br>- @typo3/backend/modal.js delegates to parent.window.TYPO3.Modal /<br> top.TYPO3.Modal, so the modal is rendered in the top backend document.<br>- Workspaces::renderSendToStageWindow() (workspaces.ts) creates the element via<br> currentModal.ownerDocument.createElement(…), i.e. in the top document, where<br> it is not defined. The element is never upgraded and renders nothing,<br> currentModal.querySelector(‘form’) returns null and convertFormToObject() fails.</typo3-workspaces-send-to-stage-form>

When the preview runs in its own tab, the top window is the preview window itself,
so the element is defined and the dialog works. If the Workspaces module was
opened earlier in the same backend session, the element should already be defined
in the top frame, which would make the bug appear intermittent.

The relevant code is identical in 13.4 and main
(Build/Sources/TypeScript/workspaces/preview.ts, backend.ts, workspaces.ts).

Possible fix
——————
Add the same top level import to preview.ts as in backend.ts:

import { topLevelModuleImport } from ‘@typo3/backend/utility/top-level-module-import’;
…
topLevelModuleImport(‘@typo3/workspaces/renderable/send-to-stage-form.js’);

Environment
—————-
TYPO3 13.4.30 and 13.4.35, composer mode, PHP 8.3.
Reproduced in Firefox, Chrome and Edge.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Fix this issue

Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

Commit message
[BUGFIX] Send to stage modal is empty when workspace preview is opened inside the "View" module Resolves: #110947 Releases: main