Skip to content

Default the window zoom factor instead of passing NaN - #137

Open
sadiqk2 wants to merge 1 commit into
NativePHP:mainfrom
sadiqk2:fix/window-zoom-factor-nan
Open

Default the window zoom factor instead of passing NaN#137
sadiqk2 wants to merge 1 commit into
NativePHP:mainfrom
sadiqk2:fix/window-zoom-factor-nan

Conversation

@sadiqk2

@sadiqk2 sadiqk2 commented Aug 14, 2026

Copy link
Copy Markdown

window/open destructures zoomFactor from an optional payload and later does:

window.webContents.on('dom-ready', () => {
    window.webContents.setZoomFactor(parseFloat(zoomFactor));
});

When the key is absent that is parseFloat(undefined)NaN, and setZoomFactor(NaN) does not no-op — the page renders at an extreme zoom. I hit this with a window showing about four enormous letters and no other symptom.

Native\Desktop\Windows\Window declares protected float $zoomFactor = 1.0 and always serialises it, so the Laravel client never reaches this path. It only surfaces for a caller that omits the key, which the endpoint otherwise permits.

The fix falls back to 1 for anything non-finite or non-positive.

window/open treats zoomFactor as optional, but parseFloat(undefined) is NaN and
setZoomFactor(NaN) renders the page at an extreme zoom rather than being ignored.

Native\Desktop\Windows\Window declares $zoomFactor = 1.0 and always serialises
it, so the Laravel client never reaches this path — it only shows up for a caller
that omits the key.
@sadiqk2

sadiqk2 commented Aug 17, 2026

Copy link
Copy Markdown
Author

@simonhamp kindly review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant