Skip to content
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 vertical positioning of popovers #674

Merged
merged 14 commits into from
Nov 30, 2024
Prev Previous commit
Next Next commit
Try again with iOS / Safari
Jaifroid committed Nov 30, 2024
commit 8521ca18cdc0bcaff2eb68b1dda7b5fc90284cd0
4 changes: 2 additions & 2 deletions www/js/lib/popovers.js
Original file line number Diff line number Diff line change
@@ -333,7 +333,7 @@ function createNewKiwixPopoverCointainer (win, anchor, event) {
div.popoverisloading = true;
const screenWidth = win.innerWidth - 40;
const screenHeight = document.documentElement.clientHeight;
const zoomFactor = 'zoom' in currentDocument.documentElement.style ? params.relativeFontSize / 100 : 1;
const zoomFactor = 'zoom' in currentDocument.documentElement.style && !isSafari() ? params.relativeFontSize / 100 : 1;
let margin = 40;
let divWidth = 512;
if (screenWidth <= divWidth) {
@@ -363,7 +363,7 @@ function createNewKiwixPopoverCointainer (win, anchor, event) {
};
// Note that since Chromium 128 getBoundingClientRect() now returns zoom-adjusted values, but if this is the case,
// then currentCSSZoom will be defined as well, so we can adjust for this. Note that UWP also requires adjustment.
if (/UWP/.test(params.appType) || 'MSBlobBuilder' in window || anchor.currentCSSZoom || isSafari()) {
if (/UWP/.test(params.appType) || 'MSBlobBuilder' in window || anchor.currentCSSZoom) {
linkRect.top = linkRect.top / zoomFactor;
linkRect.bottom = linkRect.bottom / zoomFactor;
linkRect.left = linkRect.left / zoomFactor;