rrweb icon indicating copy to clipboard operation
rrweb copied to clipboard

simulate native <select> dropdown

Open eoghanmurray opened this issue 5 years ago • 8 comments

A user clicking on a element. Would it be worthwhile to simulate the appearance of the dropdown in the replayer, even if we likely can't 100% recreate how it looked in the original browser? We have the list of so could use very generic styling and positioning to show a 'good enough' menu.

I guess we'd have to trigger on a mouseDown event on the

eoghanmurray avatar Jan 06 '21 11:01 eoghanmurray

simulating mouse clicks may take this down into a rabbit hole, if shadow-dom is handled will the issues will be resolved(staying read only and capturing only final UI changes)

no-1ne avatar Jan 07 '21 03:01 no-1ne

We are already simulating changing CSS state upon mouse hover, so I'd consider this proposal to be in the same vein. Actually I don't think I understand your comment at all! In particular: what is the relevance of shadow-dom? And what do you mean by read-only?

eoghanmurray avatar Jan 07 '21 14:01 eoghanmurray

After mouse clicks, there will be changes at the html level ( at a dom level or via shadow dom) is it possible those can be captured so that hopefully there will be no need to simulate mouse clicks and all & just capture the state of webpage.

no-1ne avatar Jan 08 '21 07:01 no-1ne

Ah okay; ya I can't see any DOM changes when a

eoghanmurray avatar Jan 08 '21 17:01 eoghanmurray

To make sure shadow dom will help, when menu is clicked, on the new UI, try right-click-inspect on that.

Yes that's the relavent issue, from comments on the thread, this seems helpful https://github.com/medialize/ally.js/blob/master/src/observe/shadow-mutations.js

no-1ne avatar Jan 08 '21 22:01 no-1ne

How would you replay the changes to the shadow dom though?

eoghanmurray avatar Jan 09 '21 17:01 eoghanmurray

It's almost like normal dom

let shadow = elementRef.attachShadow({mode: 'open'});

While To access the shadowroot let myShadowDom = myCustomElem.shadowRoot;

no-1ne avatar Jan 10 '21 01:01 no-1ne

Since iframe recording is now possible thanks to the recent commit, hope shadow dom also can also be pulled off.

no-1ne avatar Feb 12 '21 09:02 no-1ne

Looks like we can't record this with Shadow Dom. Otherwise we could do document.querySelector('iframe').contentDocument.querySelector('select').attachShadow({mode: 'open'}) on https://interactive-examples.mdn.mozilla.net/pages/tabbed/select.html image (safari)

But maybe we can create our own representation of the dropdown instead

Juice10 avatar Aug 04 '23 10:08 Juice10

I've also tried simulating mouse clicks in the past, it works for some browsers but doesn't for others.

Juice10 avatar Aug 04 '23 10:08 Juice10