satorumurmur / bibi

Bibi | EPUB Reader on your website.
https://bibi.epub.link
MIT License
833 stars 123 forks source link

Wheeling issue on iframes #110

Open julifos opened 3 years ago

julifos commented 3 years ago

Hi! I'm testing Bibi as a solution or addon for a website called libretes.com, which will offer some free epubs. When inside an iframe, seems there are some issues in both "paged" and "horizontal" modes: the scroll wheel event is populated and the entire page scrolls, so you end missing the Bibi iframe. "Vertical" mode seems to work fine. Only tested on Chrome 77 Mac:

Visual explanation: animated GIF This is apparently fixed preventing and stopping the propagation upon such conditions: embedded + paged or horizontal. In bibi.heart.js, currently at line 3058:

            const ToDo = WA != C.A_AXIS_L ? I.orthogonal('wheelings') : S.RVM == 'paged' ? 'move' : WheelObserver.OverlaidUIs.filter(OUI => OUI.contains(Eve.target)).length ? 'simulate' : '';
            if(!ToDo) return;
            if(O.Embedded&&S.RVM!='vertical'){
                Eve.preventDefault();
                Eve.stopImmediatePropagation();
            }
            //Eve.preventDefault(); // Must not prevent.
            //Eve.stopPropagation(); // No need to stop.

Sorry, I would contribute via GIT but I'm not sure how it works. Also I don't know if this is a real fix, as you are probably aware of many conditions I ignore (ie, behaviour in mobile devices, other browsers, etc.), so this code is just a suggestion (and a fix for my current conditions ;-)

BTW, many thanks for this mighty tool!