-
-
Notifications
You must be signed in to change notification settings - Fork 171
Fix libzim message handler to enable popovers and fix erratic sliding toolbars (fixes #1385, #1380) #1389
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
Fix libzim message handler to enable popovers and fix erratic sliding toolbars (fixes #1385, #1380) #1389
Conversation
- handleMessageChannelByLibzim now updates expectedArticleURLToBeDisplayed - This ensures popovers work when navigating via link clicks in SW mode - Mirrors behavior of non-libzim handleMessageChannelMessage - Fixes kiwix#1385
|
Thank you, code looks great, I'll do a bit of testing. |
|
Could you kindly update this branch with the latest changes on main using the Update branch button below? This will allow me to test properly with latest changes. |
|
PS don't forget to pull the changes to your own branch after. |
…-update-issue-1385
|
@Jaifroid I'm done updating the branch, now you can proceed with your testing. |
Jaifroid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR - please just attend to the small addition as per comment, and we'll be good to merge. Let me know if you've accepted the suggestion and are ready for me to merge. You can either use the accept suggestion button or do it yourself on your branch and push. If you use the button, please pull the changes to your local branch afterwards.
|
PS Adding the article loader fixes #1380! |
|
So you could change the title of the PR to reflect both issues it would be fixing. |
|
@Jaifroid I've done the changes as suggested. |
|
@Jaifroid I've fixed the indentation as suggested, i'm really sorry about the confusion earlier! I was looking at the wrong message channel (around line 2743) instead of the libzim channel (lines 1109-1110). Total brain fog moment on my part. 🤦♂️
|
Fix: Add articleLoader and appstate updates to libzim message handler
Issues
Fixes #1385 and #1380
Issue #1385: Popovers not working in libzim mode
Popovers were not working consistently in libzim mode with Service Worker. Specifically:
Issue #1380: Erratic sliding toolbars with Zimit classic archives
Sliding away toolbars were erratic with Zimit classic archives when using libzim backend due to not attaching the correct iframe for postprocessing in the libzim message channel.
Root Causes
For #1385:
The
handleMessageChannelByLibzim()function was not updatingappstate.expectedArticleURLToBeDisplayedwhen delivering HTML content to the Service Worker. This caused the variable to remain stuck at the landing page URL even after navigating to different articles.The popover module checks this variable to determine if the current page is a landing page (where popovers are intentionally disabled to avoid interfering with interactive maps). Since the variable was never updated, the check would always think the user was still on the landing page, blocking popovers on all subsequent pages.
For #1380:
The libzim message channel was not calling
articleLoader()to properly attach the iframe for postprocessing, causing the toolbar gesture detection to malfunction.Solution
Updated
handleMessageChannelByLibzim()to:handleMessageChannelMessage()by updatingappstate.baseUrlandappstate.expectedArticleURLToBeDisplayedwhen serving HTML contentarticleLoader()call to attach the correct iframe for postprocessingThis ensures proper state tracking and iframe attachment during link-based navigation in Service Worker + libzim mode.
Changes
handleMessageChannelByLibzim()(lines 1094-1098 in app.js)appstate.baseUrlandappstate.expectedArticleURLToBeDisplayedfor HTML contentarticleLoader()call to properly attach iframe for postprocessing