Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support top-layer <dialog> recording & replay #1503

Merged
merged 34 commits into from
Aug 2, 2024
Merged

Conversation

Juice10
Copy link
Contributor

@Juice10 Juice10 commented Jun 10, 2024

Fixes #1381.

Adds support for recording & replaying Top Layer <dialog> elements. These elements float over any other elements no matter the z-index.

What this PR does not do:

  • trigger showModal() on rrweb-snapshot's rebuild
    • when rebuild is called we have no guarantee the element is added to the dom, and .showModal() has to be attached to be called, so the responsibility to do this is hoisted to rrweb & rrdom.
  • add support for popover elements.
  • add support for requestFullScreen elements.
  • register order of top layer dialog elements, this is impossible to do without monkey patching HTMLDialogElement.showModal, and although that is possible I didn't have time to implement it. However most of the time this PR should sufficient. Unfortunately there is no way to query the dom for the order of elements in the top layer, as that would have made this doable without monkey patch, and recordable in rrweb-snapshot.
    • exact case where this breaks:
    •   const dialog1 = document.createElement('dialog') as HTMLDialogElement;
        dialog1.className = 'dialog1';
        document.body.appendChild(dialog1);
        const dialog2 = document.createElement('dialog') as HTMLDialogElement;
        dialog1.className = 'dialog2';
        document.body.appendChild(dialog2);
        dialog2.showModal(); // <== Note that dialog TWO is being triggered first, if dialog 1 was triggered first, this would have replayed as expected.
        dialog1.showModal();

Copy link

changeset-bot bot commented Jun 10, 2024

🦋 Changeset detected

Latest commit: 9f2a27c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages
Name Type
rrweb-snapshot Major
rrdom Major
rrweb Major
@rrweb/types Major
@rrweb/rrweb-plugin-canvas-webrtc-record Major
@rrweb/rrweb-plugin-canvas-webrtc-replay Major
@rrweb/rrweb-plugin-console-record Major
@rrweb/rrweb-plugin-console-replay Major
@rrweb/rrweb-plugin-sequential-id-record Major
@rrweb/rrweb-plugin-sequential-id-replay Major
rrdom-nodejs Major
rrweb-player Major
@rrweb/all Major
@rrweb/replay Major
@rrweb/record Major
@rrweb/packer Major
@rrweb/web-extension Major
rrvideo Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Juice10 Juice10 marked this pull request as draft June 10, 2024 09:04
@Juice10 Juice10 changed the title [draft] dialog recording Support top-layer <dialog> recording & replay Jun 12, 2024
@Juice10 Juice10 marked this pull request as ready for review June 12, 2024 15:19
@YunFeng0817 YunFeng0817 self-requested a review June 12, 2024 16:55
Copy link
Contributor

@daibhin daibhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!! Thanks for taking this on :)

packages/rrweb/test/replay/dialog.test.ts Outdated Show resolved Hide resolved
Copy link
Member

@YunFeng0817 YunFeng0817 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing this. Overall, it looks good

packages/rrweb/src/replay/index.ts Outdated Show resolved Hide resolved
packages/rrweb/src/replay/dialog/index.ts Outdated Show resolved Hide resolved
packages/rrweb/src/replay/index.ts Outdated Show resolved Hide resolved
@Juice10 Juice10 merged commit 335639a into master Aug 2, 2024
11 checks passed
@Juice10 Juice10 deleted the juice10/record-dialog branch August 2, 2024 07:53
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.

[Feature Request]: Support top-layer / dialog HTML component
4 participants