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

set screenY and screenTop to 0 when equal to screen height #889

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/features/web-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ import { URL } from '../captured-globals.js'
/**
* Fixes incorrect sizing value for outerHeight and outerWidth
*/
function windowSizingFix () {
function windowSizingFix (settings) {
// macOS browser incorrectly reports screen height for window.screenY / window.screenTop
if (window.screenY === window.screen.height) {
let screenYOverride = settings?.screenYOverride

if (typeof screenYOverride === 'undefined') {
// @ts-expect-error - typescript known about availTop in this context
screenYOverride = window.screen.availTop
}

window.screenY = window.screenTop = screenYOverride
}

if (window.outerHeight !== 0 && window.outerWidth !== 0) {
return
}
Expand Down Expand Up @@ -76,7 +88,8 @@ export default class WebCompat extends ContentFeature {

init () {
if (this.getFeatureSettingEnabled('windowSizing')) {
windowSizingFix()
const settings = this.getFeatureSetting('windowSizing')
windowSizingFix(settings)
}
if (this.getFeatureSettingEnabled('navigatorCredentials')) {
this.navigatorCredentialsFix()
Expand Down
Loading