-
Notifications
You must be signed in to change notification settings - Fork 67
Closed
Description
Safari and Chrome have a different scene.height if content is less than the browsers height
It looks like Safari takes the height of the rendered content if it's less.
SSCCEE
module Main exposing (main)
import Browser
import Browser.Dom
import Html exposing (..)
import Task
main : Program () (Maybe Browser.Dom.Viewport) Msg
main =
Browser.document
{ init = \_ -> ( Nothing, Task.attempt GotViewport Browser.Dom.getViewport )
, update = update
, subscriptions = \_ -> Sub.none
, view = \viewport -> { title = "", body = [ text (Debug.toString viewport) ] }
}
type Msg
= GotViewport (Result () Browser.Dom.Viewport)
update : Msg -> Maybe Browser.Dom.Viewport -> ( Maybe Browser.Dom.Viewport, Cmd Msg )
update msg viewport =
case msg of
GotViewport (Ok x) ->
( Just x, Cmd.none )
GotViewport _ ->
( viewport, Cmd.none )Safari:
{ scene = { width = 840, height = 34 }
, viewport = { x = 0, y = 0, width = 840, height = 480 }
}
Chrome:
{ scene = { width = 840, height = 480 }
, viewport = { x = 0, y = 0, width = 840, height = 480 }
}
Metadata
Metadata
Assignees
Labels
No labels