Skip to content

fix(ew): record RUM click events from WYSIWYG layout mode (#1324) - #1384

Open
dicagno wants to merge 4 commits into
mainfrom
rumclick
Open

dicagno wants to merge 4 commits into
mainfrom
rumclick

Conversation

@dicagno

@dicagno dicagno commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Clicks inside the WYSIWYG/layout preview iframe never reach the host document, so the RUM enhancer never recorded ew-wysiwyg-doc click checkpoints. Handle the new RUM_CLICK message forwarded from the quick-edit iframe and record it on the host session's RUM via sampleRUM('click', ...). Requires the matching da-nx change that sends RUM_CLICK.

Full test URL (to check functionality end to end): https://rumclick--da-live--adobe.aem.live/canvas?rum=on&nx=rumclick&quick-edit=rumclick#/exp-workspace/frescopa/index

Then paste in devTools console: document.addEventListener('rum', e => console.log('RUM', e.detail.checkpoint, e.detail.data)); and click on any element in the quickedit, to check if click checkpoints are dispatched.

Description

Adds a handler for the new RUM_CLICK message on the quick-edit iframe → host port. When the WYSIWYG/layout preview iframe forwards a click, the host records it on the current session's RUM via window.hlx.rum.sampleRUM('click', { source, target }), producing ew-wysiwyg-doc click checkpoints — the layout-surface counterpart to the ew-editor-doc checkpoints the RUM enhancer already emits for the shadow-DOM source editor. It's a no-op when the session isn't RUM-selected.

Pairs with the da-nx PR that sends RUM_CLICK. Both must deploy together; until then the handler is inert (the message is never sent, and the unknown type simply never matches).

Related Issue

Fixes #1324

To be merged together with adobe/da-nx#778

Motivation and Context

Click events are captured in the document/content editor (ew-editor-doc) but not in layout mode. The layout/WYSIWYG surface renders inside a cross-origin <iframe> loaded with ?rum=off, so its clicks never bubble to the host document and the host RUM enhancer cannot see them — no ew-wysiwyg-doc checkpoints were ever recorded, including for in-iframe dialogs and toolbars. This restores usage telemetry for the layout surface.

How Has This Been Tested?

  • Unit: new cases in test/unit/blocks/canvas/ew-editor-wysiwyg/quick-edit-controller.test.js assert a forwarded RUM_CLICK calls sampleRUM('click', …) with the payload, and that it no-ops safely when RUM isn't initialised on the page. Full da-live unit suite green (2344 passed, 4 skipped).
  • Manual (end-to-end): ran da-live against local da-nx (?nx=local), opened a doc in layout mode with ?rum=on, and confirmed via a document.addEventListener('rum', …) probe that clicks in the WYSIWYG canvas (and in-iframe dialogs/toolbars) emit RUM click { source: 'ew-wysiwyg-doc', … }, while ew-editor-doc clicks are unchanged.

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

🤖 Generated with Claude Code

Clicks inside the WYSIWYG/layout preview iframe never reach the host document, so the RUM enhancer never recorded ew-wysiwyg-doc click checkpoints. Handle the new RUM_CLICK message forwarded from the quick-edit iframe and record it on the host session's RUM via sampleRUM('click', ...). Requires the matching da-nx change that sends RUM_CLICK.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@aem-code-sync

aem-code-sync Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@dicagno
dicagno marked this pull request as ready for review September 25, 2026 09:12
dicagno and others added 2 commits September 29, 2026 16:42
Matches adobe/da-nx#778: the iframe now sends MESSAGE_TYPES.IFRAME_CLICK
('iframe-click') with { target?: string }. The host owns RUM attribution
and adds source: 'ew-wysiwyg-doc' when calling sampleRUM.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@hannessolo

Copy link
Copy Markdown
Contributor
Screen.Recording.2026-09-30.at.16.04.35.mov

Clicking the block selection button in wysiwyg doesn't generate an event

This branch was successfully deployed

1 active deployment
rumclick — 13b5324b Deployed Oct 2, 2026 by aem-code-sync[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[EW] no RUM (click) events are captured while in layout mode

2 participants