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

Right now the V&U spec doesn't mention anything special about whether
the presence of scrollbars affects the size of the vw/vh units.
Here's a testcase:

<!DOCTYPE html>
<div></div>
<style>
body { margin: 0; overflow: scroll; }
div {
  background: url('http://xanthir.com/pony') no-repeat right top silver;
  width: 100vw; height: 100vh;}
</style>

(Alter the overflow value to get different results.)

In the two browsers that currently support vw/vh, Chrome and IE,
neither one pays any attention to scrollbars.  Regardless of the value
of overflow on <body>, they set the two values to the width/height of
the scrollbar-less viewport.

This seems suboptimal when we *know* that scrollbars will appear, like
if overflow:scroll is set on body.

Should the vw/vh units respond to this, and subtract the size of the
scrollbars from their viewport size?

(In some cases we can't tell, like if <body> is overflow:auto.  In
that case, I think it's reasonable to either always ignore or always
assume scrollbars.  Current behavior in browsers is to always ignore,
so I'm fine with sticking to that.)

~TH

Received on Monday, 3 December 2012 23:03:08 UTC