Skip to content

Commit

Permalink
fix: add bottom padding to container for iOS Safari (#1993)
Browse files Browse the repository at this point in the history
* add bottom padding to container for iOS Safari

* exclude ff, edge, yandex, ucbrowser
  • Loading branch information
limonte committed Jun 6, 2020
1 parent 2480b71 commit 1378a78
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/utils/iosFix.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ export const iOSfix = () => {
document.body.style.top = `${offset * -1}px`
dom.addClass(document.body, swalClasses.iosfix)
lockBodyScroll()
addBottomPaddingForTallPopups() // #1948
}
}

const addBottomPaddingForTallPopups = () => {
const safari = !navigator.userAgent.match(/(CriOS|FxiOS|EdgiOS|YaBrowser|UCBrowser)/i)
if (safari) {
const bottomPanelHeight = 44
if (dom.getPopup().scrollHeight > window.innerHeight - bottomPanelHeight) {
dom.getContainer().style.paddingBottom = `${bottomPanelHeight}px`
}
}
}

Expand Down

0 comments on commit 1378a78

Please sign in to comment.