-
Notifications
You must be signed in to change notification settings - Fork 16
AppendVirtualColumnIfNeeded Firefox workaround #118
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
Comments
Thanks for pointing this out. The root of the issue being 14 years old, I’m not holding my breath for a quick resolution in that case. In order to minimise possible side-effects, I’d probably be inclined to check for the lack of I can’t really tell if there are other scenarios myself at the moment, I’d be just super cautious with the things we added in the Preferences API such as If there are such issues, maybe there could be alternative options. In the Preferences API branch, it’s worth mentioning we are checking the number of columns that are actually needed for the |
Alright so could give this a quick look. Setting I can see the The div flows without any fragmentation break but since its height is the height of the column, that works as it should always overflow into the next column. I’ve tested an alternative workaround that perhaps keep the spirit of the original function for Firefox:
Basically, this makes sure the height is large enough that the virtualCol will be entirely laid out in a column by avoiding a break inside – that Firefox supports. I’m probably leaning towards implementing something like this in the Preferences API branch for the time being:
So that it can cover all cases with some peace of mind because we have to handle Note @chocolatkey Do you reckon this should also be fixed in |
Hi @JayPanoz, thanks for testing this. The |
@wrCisco in theory anything I've not taken the deepest look into the rendering engine's source code and its quirks, mind you, but it seems reasonable to me right now after testing. Being in charge of ReadiumCSS, the implementation of the Preferences API in ts-toolkit – which has a massive impact –, and leading the development of Thorium Web, you can be reassured I'll have to make sure it works w/o any noticeable side effect and resolve edge cases if they ever pop up. Thanks again for pointing this out! 🙏 |
Probably a good idea. You could check with @oscar-rivera-demarque who maintains the DeMarque implementation if this will break anything there since they are the biggest "old" ts-toolkit user |
As a resolution during the Readium Web meeting, we agreed to merge the fix through PR #106 in version 2. It has been marked as ready for review, although some details still have to be discussed. Unless there is a strong request to also commit it into |
I tried to do some testing, most of the time on Firefox I can turn the pages without problems, but if the last page of a section contains only one or two lines of text and is not a multiple of the "pages per view", the first added div does not shift to the next column and the bug is still there. I'm not sure if I'm doing something wrong, I cloned the Preferences API branch, built the workspaces as specified in the READMEs and opened a book with the testapp. |
@wrCisco Thanks for catching that, my original assumption was actually wrong with the So yeah, on Firefox, the virtual column being 80% height of the : |
Firefox doesn't support
break-before: "column"
, so appendVirtualColumnIfNeeded in navigator-html-injectables/src/helpers/document.ts is not generally effective there. The same problem is present in the updated version of the function in the Preferences API branch.ts-toolkit/navigator-html-injectables/src/helpers/document.ts
Lines 19 to 43 in 2a44a91
I added a new check right after the line
wnd.document.body.appendChild(virtualCol);
and conditionally set the height of the virtualCol equal to the body's clientHeight:It seems to work ok in Firefox and Chrome, but I'm not sure if there are other scenarios that I didn't consider in which this solution could cause problems.
The text was updated successfully, but these errors were encountered: