Skip to content

Commit 06d95ff

Browse files
committed
update windowSizingFix to use config setting, or screen.availTop if not defined
1 parent ec388a9 commit 06d95ff

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/features/web-compat.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ import { URL } from '../captured-globals.js'
44
/**
55
* Fixes incorrect sizing value for outerHeight and outerWidth
66
*/
7-
function windowSizingFix () {
8-
// macOS browser incorrectly reports window height for window.screenY / window.screenTop
7+
function windowSizingFix (settings) {
8+
// macOS browser incorrectly reports screen height for window.screenY / window.screenTop
99
if (window.screenY === window.screen.height) {
10-
window.screenY = window.screenTop = 0
10+
let screenYOverride = settings?.screenYOverride
11+
12+
if (typeof screenYOverride === 'undefined') {
13+
// @ts-expect-error - typescript known about availTop in this context
14+
screenYOverride = window.screen.availTop
15+
}
16+
17+
window.screenY = window.screenTop = screenYOverride
1118
}
1219

1320
if (window.outerHeight !== 0 && window.outerWidth !== 0) {
@@ -81,7 +88,8 @@ export default class WebCompat extends ContentFeature {
8188

8289
init () {
8390
if (this.getFeatureSettingEnabled('windowSizing')) {
84-
windowSizingFix()
91+
const settings = this.getFeatureSetting('windowSizing')
92+
windowSizingFix(settings)
8593
}
8694
if (this.getFeatureSettingEnabled('navigatorCredentials')) {
8795
this.navigatorCredentialsFix()

0 commit comments

Comments
 (0)