Re: [css-device-adapt] How should initial viewport contribute to layout?

On Wed, Feb 12, 2014 at 2:36 PM, Matt Rakow <marakow@microsoft.com> wrote:
>
> > Fixed-pos element attachment seems still controversial. The browsers
> (all but IE?) not following the spec may base on the following point:
> developers who put fixed-pos elements in the page might expect they'd be
> always visible. Perhaps "position: device-fixed" (
> http://quirksmode.org/blog/archives/2010/12/the_fifth_posit.html) is the
> solution to the controversy.
>
> We did a lot of research on this point in IE10 as we added our touch
> support.  We found that the majority of scenarios had a stronger
> expectation of fixed elements aligning with the page content than always
> being on-screen.  Good examples of this are sidebar
> navigation/widgets/advertisements that float down the side of the page, or
> bottom-aligned toolbars that center-align perfectly with the content
> wrapper.  Maintaining that promise of aligned content offered better
> compatibility with existing web content than the "device-fixed" behavior.
>

In Chrome for Android we're currently always aligning with the visual
viewport, but I agree that has bad results in many cases and we're
currently redesigning this.

The use cases you mention apply to align to page content on the X axis, but
there tend to be fewer problems on the Y axis.  For that reason we're
considering aligning "position: fixed" elements to the initial viewport on
the X axis, but the visual viewport on the Y axis.  That way, the use cases
you mention still work OK, but top and bottom fixed-pos bar would always
remain onscreen and it becomes possible to interact with them without
excessive fiddling.



>
> However, definitely agreed that there are cases where the developer wants
> always-on-screen UI.  In IE11 we added the position value -ms-device-fixed
> that has this behavior (immune to both zooming and scrolling, and attaches
> to the visual viewport).  *This is the one case where visual viewport
> changes can impact layout -- if the size of the visual viewport changes due
> to overlay UI showing/hiding.
>
> Thanks,
> -Matt
>

Received on Wednesday, 12 February 2014 23:19:53 UTC