elm / browser

Create Elm programs that run in browsers!
https://package.elm-lang.org/packages/elm/browser/latest/
BSD 3-Clause "New" or "Revised" License
313 stars 64 forks source link

onResize not returning the right height when embedded in "Chrome Custom Tabs" #98

Open lucamug opened 5 years ago

lucamug commented 5 years ago

We experienced a case where the height returned by Browser.Events.onResize was 0 instead of the actual height.

The method to get width and height described in https://stackoverflow.com/questions/1248081/get-the-browser-viewport-dimensions-with-javascript seems giving more accurate results:

var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);

We didn't test this method but in general we were wondering if this could be a safer approach...