Re: [css3-values] Interaction of vw/vh and scrollbars

Le 06/03/2013 17:00, James Holderness a écrit :
> I've been looking at the way viewport-percentage lengths are implemented,
> and I was surprised to find that when scrollbars are visible, their behavior
> doesn't match that of percentage width and height on the root element.
>
> I understand that this was discussed at some length earlier this year, and
> it seems this behavior was agreed upon, but with an exception for certain
> values of overflow. However, the wording in the current editor's draft isn't
> very clear to me.
>
> Am I correct in thinking the existing browser behavior (ignoring the
> presence/absence of scrollbars in their calculations) is correct if the
> overflow is 'auto', but if the overflow is anything else (although I don't
> see how anything other than 'scroll' would make any difference) they should
> take the scrollbars into account, and report a smaller width/height?

I believe this is correct. However this was decided very recently and 
only put in the ED yesterday, so I wouldn’t be surprised if 
implementations have not caught up yet.


> Also, in the January discussions, I recall someone saying that this
> interpretation of the viewport size matched that of media queries. However,
> having tested a couple of browsers they certainly don't all behave the same
> way for that. On Firefox and Opera, the appearance of a scrollbar does not
> effect the width/height used in media queries, but on Chrome (25.0.1364.97)
> it does. Is that a bug in WebKit?


http://www.w3.org/TR/css3-mediaqueries/#width says:
> For continuous media, this is the width of the viewport (as described
> by CSS2, section 9.1.1 [CSS21]) including the size of a rendered
> scroll bar (if any).

In my understanding of "including", adding a scrollbar (which makes 
:root{width:100%} smaller) does not change the value of 'width' in MQs. 
In other words, I think this is a bug in WebKit.

-- 
Simon Sapin

Received on Wednesday, 6 March 2013 16:46:43 UTC