-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Extend popover support to new tabs or windows #1253
Comments
Hii, I would like to work on this issue. |
@tinkerer-shubh Please read CONTRIBUTING in this Repo very carefully, and try to set up, and then come back here and explain your proposed solution to this issue. |
@Jaifroid Thank you so much! I really appreciate your guidance and would love your input as I move forward with this. Here’s my proposed approach for extending popover support to new windows and tabs: I’d love to hear your thoughts on this plan and whether you’d recommend starting with a specific step. |
@tinkerer-shubh Thanks for your thoughts. I don't think either suggested method is the first thing to try. There may be a simpler fix. We will only be opening new tabs or windows in Same Origin, so we can communicate with those windows. For new tabs/windows currently the main method of communication is that the Service Worker intercepts their Fetch requests and then asks However, the tricky thing here is that there is no way to tell if a hyperlink is being hovered unless an event listener is attached to it or to a parent. Since we try hard not to alter DOM content, the solution has been to add an event listener to the iframe window/document. But when we open a new window, we no longer place content in an iframe: it is placed directly in the window. Therefore, once the initial content has loaded in that window, we will need to attach an event listener to the window or the window's document so that it will fire when a link is hovered or tabbed into. Currently, the popover interceptor is added here, straight after the content is loaded in the new iframe. That code currently only runs if there's an iframe. The trick will be to see if you can make it run when the content is not in an iframe but in a separate window or tab. Then you'll need to debug other places in the code where an iframe is assumed. The idea would be to generalize the attaching code as much as possible. It may be possible to use |
Once #1252 is finished, it might be a good idea to extend popover support to new windows and tabs opened by the app.
This is a bigger job, hence would need to be a separate PR. Up till now, we have not attempted to keep any reference to new containers, and so we can't track them in order to add the necessary event listeners. This is done in the PWA, but there is quite a lot of infrastructure associated with it there. It might be possible to do a "light" version here.
For info, tabs and windows are navigable in ServiceWorker mode, because the SW deals with the page's Fetch requests. But the SW doesn't have any access to the DOM, so cannot process links to add popovers.
The text was updated successfully, but these errors were encountered: