[PP-1] Prevent more scenarios where a user may navigate from inside the preview iFrame

Created on 20 November 2024, 8 months ago

Overview

In โœจ Initial support for allowing interaction with the preview Active the ability for a user to interact with the page they are previewing was added. By allowing a user to interact with the preview, we need to prevent the user from navigating to a different URL within the iFrame.

The simplest use case of clicking links was handled in that original MR. Links are intercepted and we display a modal dialog to allow the user to see the URL and opt to open it in a new window.

Proposed resolution

There are more scenarios in which a user might trigger navigation and where possible we should intercept/block these too.

A non-exhaustive list of possible scenarios and potential ways to capture them provided as an example of things to consider here.

  1. Form submission - capturing the 'submit' event with an eventListener
  2. Using the beforeunload event to capture other unexpected ways people may leave
  3. JS based page navigation - a button/event might change the window.location or use methods like location.assign(), location.replace(), or history.pushState(). Intercepting these requires overriding these methods.

    This should follow a similar pattern to the current interception of links. They are currently handled with a Drupal behavior that calls preventDefault on the link and then sends a postMessage to the parent window that the React app can listen for (see ui/assets/js/xbDisableLinksBehavior.js).

โœจ Feature request
Status

Active

Version

0.0

Component

Page builder

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom jessebaker

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024