-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Description
Version
3.1.1
Reproduction link
https://codesandbox.io/s/determined-yonath-3hccx
Steps to reproduce
- open child window with a click on "open,close window" for the first time and wait 3 seconds
- click on message --> nothing happens
- wait 3 seconds and click again --> nothing happens
- wait another 15 seconds and click again --> alert message in "main" window appears (chrome: if devtools are closed, a dot on the tab of main window notifies you, that an alert is there)
So you see, there is a relatively long time until the click handler will be registered (about 15-20 seconds)
Now close the window with a click on "open,close window" in main window.
If you repeat the above steps, the click handler will only be called after a few minutes (1-2 minutes; if it won't work, leave it open and try it after 5-10 minutes).
With every close/open new window the time increases.
Important: Do not click too often after opening the window! It seems that the click eventhandler never gets registered if you click too often.
Info: firefox appears to be faster than chrome. After repeating this 4 times firefox needs about 3 minute that the click event is handled. chrome much more.
What is expected?
click events should be fired/registered immediately
What is actually happening?
it seems the click event will be registered delayed.
I found have a problem with click events on components, that are opened in a new browser window with vue 3.
I open a vue 3 component in a new window like the following code (copied and customized from https://github.com/Shamus03/vue-window-portal):
<template>
<teleport to="body">
<div v-if="open" v-show="windowLoaded" ref="teleportingContent">
<slot></slot>
</div>
</teleport>
</template>
...
methods: {
openPortal() {
this.windowRef = window.open('', '', '');
this.windowRef.document.body.innerHTML = '';
const app = document.createElement('div');
app.id = 'app';
app.appendChild(this.$refs.teleportingContent);
this.windowRef.document.body.appendChild(app);
}
}
...
With this code the slot component will be attached to the DOM of the new opened window. This works and the vue objects/props are reactive in the new window.
The problem is if there is a click-eventhandler on an element, which is attached to DOM of the new window. It seems that the click event is registered delayed.
If the window is closed/opened multiple times, the time of the click registration increases every time.
I want to be able to "dock off" some content of the main window to a new window (e. g. from a video conference push two video participants to new windows; move a component to a new window for comparing content in two screens).